we are using XStream v1.2.2 in the project, and JaCoCo in the CI.
The tests are failing with an ObjectAccessException ( see xstream-jacoco-stacktrace.txt )
After some googling a have found, that:
"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."
(https://www.eclemma.org/jacoco/trunk/doc/faq.html)
In the sources of the XStream I have found PureJavaReflectionProvider:151
protected boolean fieldModifiersSupported(Field field) {
return !(Modifier.isStatic(field.getModifiers())
|| Modifier.isTransient(field.getModifiers()));
}
So, there is no handling of synthetic fields (" || field.isSynthetic()") (?).
I took a look at v1.4.9, and the situation stays pretty much the same:
protected boolean fieldModifiersSupported(Field field) {
int modifiers = field.getModifiers();
return !(Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers));
}
Question:
Is there a way to bypass the issue while staying with version 1.2.2 ?
Should we report a bug ?
Kind regards,
Dmytro