Hi,

JaCoCo works on class files only. It reports whatever it sees in the class files which get instrumented and analyzed. Future versions might come with the option to filter certain constructs, but for AspectJ this will probably not work as you can inject any code.

To solve this you have to make sure that the class files get instrumeted by JaCoCo *before* AspectJ kicks in. If you use the AspectJ agent it has to be configured after the JaCoCo agent. If you want to pre-compile your classes you can use JaCoCo offline instrumentation first: http://www.eclemma.org/jacoco/trunk/doc/offline.html

Regards,
-marc


On 2015-08-14 07:16, zhz shi wrote:
Hi,

We're using AspectJ in our project and also Jacoco for test coverage
report, currently we're facing an issue that due to AspectJ changed
the byte code during compiling phase, which makes the code coverage
report not correct. One example is due to AspectJ adds extra if-else
statement, then the branch coverage shows something like 1/4 but
actually there's no condition branch in the source code. Is there some
good way to tell Jacoco to ignore all code generated by AspectJ?

I also created an issues 335 [1] on Github and posted an question on
SO [2].

Thanks a lot.

 --
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/e96a08b4-8c44-469a-b32b-52f013e57bbd%40googlegroups.com
[3].
For more options, visit https://groups.google.com/d/optout [4].


Links:
------
[1] https://github.com/jacoco/jacoco/issues/335
[2]
http://stackoverflow.com/questions/32001843/jacoco-code-coverage-is-affected-by-aspectj
[3]
https://groups.google.com/d/msgid/jacoco/e96a08b4-8c44-469a-b32b-52f013e57bbd%40googlegroups.com?utm_medium=email&utm_source=footer
[4] https://groups.google.com/d/optout

--
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/5d10b47fe28d7712d83c101540dd3689%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to