jacoco maven plugin interference with spring UriComponentsBuilder

23 views
Skip to first unread message

gise...@yachay.net

unread,
Mar 22, 2019, 4:38:11 PM3/22/19
to JaCoCo and EclEmma Users

gise...@yachay.net

unread,
Mar 22, 2019, 4:40:09 PM3/22/19
to JaCoCo and EclEmma Users
I used spring 4.3.10.RELEASE and 4.3.18.RELEASE

Evgeny Mandrikov

unread,
Mar 22, 2019, 4:58:38 PM3/22/19
to JaCoCo and EclEmma Users

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.

In other words:
If your code uses reflection, then change it to ignore synthetic members.
If code of third-party library uses reflection, then request vendor of this library to change their code to ignore synthetic members.

Or exclude this "POJO" from instrumentation by JaCoCo.

Or if you are lucky to be able to use Java 11, then you can try to use next (not yet released) 0.8.4-SNAPSHOT version of JaCoCo which doesn't add synthetic field to Java 11 class files.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages