Quoting FAQ ( https://www.jacoco.org/jacoco/trunk/doc/faq.html ) :

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.


On Friday, March 22, 2019 at 9:38:11 PM UTC+1, [email protected] wrote:
>
> Steps to reproduce
>
> When invoking org.springframework.web.util.UriComponentsBuilder to build a 
> uri query from a Java POJO, some Jacoco_data gets embedded into the result. 
> It is getting confused with "instrument_types"
>
> JaCoCo version: 0.8.0-0.8.3
> Operating system: Mac High Sierra
> Tool integration: Maven
> Expected behaviour
>
> "
> http://localhost/test/v2/fees?disable_catalog=false&purchaser=XOOM&send_amount=10&destination.types=LEGACY_BILLPAY&destination.types=TOP_UP&destination.types=DELIVERY&destination.types=ATM&destination.country_code=GT&destination.currency_code=GTQ&funding.instrument_types=DRN&funding.instrument_types=ACH&funding.instrument_types=CARD&funding.country_code=US&funding.currency_code=USD
> "
> Actual behaviour
>
> Response contains ".$jacoco_data=" at the end as you see in:
>
> "
> http://localhost/test/v2/fees?disable_catalog=false&purchaser=XOOM&send_amount=10&destination.types=DEPOSIT&destination.types=DELIVERY&destination.types=LEGACY_BILLPAY&destination.types=BILL_PAY&destination.types=PICKUP&destination.country_code=GT&destination.currency_code=GTQ&destination.$jacoco_data=[Z@71304a7c&funding.instrument_types=CARD&funding.instrument_types=DRN&funding.country_code=US&funding.currency_code=USD&funding.$jacoco_data=[Z@11e1b0e7&$jacoco_data=[Z@782516dc
> "
>
>
> Any advice would be appreciated.
>
>
> Gisella
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/ccefca0f-44ca-4473-9cfb-02f29f1c0306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to