Conflicts with JaCoCo

42 views
Skip to first unread message

kongy...@gmail.com

unread,
Aug 4, 2016, 8:24:29 AM8/4/16
to JaCoCo and EclEmma Users
Hi,

Here is a situation.

I develop another java agent which used to instrument some byte code to record some log information.

Then I also want to use JaCoCo to calculate the coverage about original java code.

Is there any conflict between these java agents?

Does JaCoCo has some function that rollback the byte code which is redefined by another java agent?

Thanks!

-- Kevin Kong

Evgeny Mandrikov

unread,
Aug 4, 2016, 11:54:35 AM8/4/16
to JaCoCo and EclEmma Users
Hi,

I don't think that there is a way for one class transformer to rollback modifications done by another class transformer in general without exact knowledge of the performed transformation. Thus there is no such function in JaCoCo: its changes are always done on top of changes done by previous transformers - as per https://docs.oracle.com/javase/7/docs/api/java/lang/instrument/ClassFileTransformer.html "transformers are called in the order registered".

So to make sure that you'll be able generate coverage report - specify JaCoCo agent before your agent in command line ( see "What workarounds exist to deal with runtime-modified classes?" http://www.eclemma.org/jacoco/trunk/doc/classids.html ). This way JaCoCo will see original classes and your agent will see classes instrumented by JaCoCo.

Hope this helps.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages