When trying to run Coverage as or run a maven build using emma:emma I get the following:
java.lang.IllegalStateException: Could not access method: Can not set static final [Z field packageName.ClassName.$jacocoData to [Z
So I searched around online and I found the following on the EclEmma website:
My code uses reflection. Why does it fail when I execute it with JaCoCo?
To collect execution data JaCoCo instruments the classes under test which adds two members to the classes: A private static field $jacocoData and a private static method $jacocoInit(). Both members are marked as synthetic.
Please change your code to ignore synthetic members. This is a good practice anyways as also the Java compiler creates synthetic members in certain situation.
But I cannot find any documentation on the web on how to actually ignore synthetic members with Emma.
In STS I look under Preferences/Java/Code Coverage and I see an Excludes box to put exclusions (and I know I could also put the exclusion in my POM).
I am just wondering what needs to go in there to exclude all synthetic classes.
Thanks
$jacocoData
is to know the fact that it is always appended at the end of the class members' list. Though, I would we very interested to know how to exclude any synthetic member of a Java/Scala class. – Sainted