EclEmma coverage on base Java language (Native Classes eg java.lang.String)

43 views
Skip to first unread message

jam...@gmail.com

unread,
Jan 26, 2018, 4:00:24 AM1/26/18
to JaCoCo and EclEmma Users
Cannot drill down into the methods of java.lang.String

I wanted to demonstrate the effectiveness of EclEmma to a Japanese audience by generating a coverage report on JUnit Test Class based on java.lang.String for example, but I cannot drill down into the methods of java.lang.String. I have tried a few different java classes with no possibity of expand down into the methods.

I experimneted using a different library (Apache Commons Codec org.apache.commons.codec.binary.Base64) and that works fine, I can expand down into all the methods..

Can eclEmma produce reports on the base Java language (native java libraries eg java.lnag.* etc)?

Will greatly appreciate your expertise, time and help on this.

Jeff

Evgeny Mandrikov

unread,
Jan 26, 2018, 6:30:05 AM1/26/18
to JaCoCo and EclEmma Users
EclEmma is based on JaCoCo agent, which transforms bytecode of classes for recording of coverage.
By default JaCoCo agent doesn't transform classes that loaded by bootstrap classloader ("java.lang.*" and some others) - this is controlled by agent option "inclbootstrapclasses" ( see http://www.jacoco.org/jacoco/trunk/doc/agent.html ) , which is however not exposed in EclEmma preferences.
Also note that even when this option is set to "true", classes won't be transformed if JVM loads them prior to start of agent.
In particular "java.lang.String" is loaded at the very beginning of JVM startup.
Among other interesting JVM debugging options, there is "-verbose:class" that can be used to see which classes are loaded and in which order.

Regards,
Evgeny

jam...@gmail.com

unread,
Jan 28, 2018, 7:00:16 PM1/28/18
to JaCoCo and EclEmma Users
Thanks so much for the quick and helpful response.

Jeff

jam...@gmail.com

unread,
Feb 1, 2018, 12:55:20 AM2/1/18
to JaCoCo and EclEmma Users
On Friday, January 26, 2018 at 8:30:05 PM UTC+9, Evgeny Mandrikov wrote:

1. Please help/tell me how to run the jacocoagent with "inclbootstrapclasses=true" option?

> By default JaCoCo agent doesn't transform classes that loaded by bootstrap classloader ("java.lang.*" and some others) - this is controlled by agent option "inclbootstrapclasses" ( see

>>I am having difficulty running the jacocoagent. I have eclEmma as a plugin for Eclipse4.5, but couldn't find the jacocoagent.jar.
I downloaded the latest jacoco version 080 and tried runnning java -javaagent:[current_path]jacocoagent.jar=inclbootstrapclasses=true, but could not get to run.

2.


JVM debugging options, there is "-verbose:class" that can be used to see which classes are loaded and in which order.

>> Thanks for this, -verbose was an useful reference.

Thanks for your time and expertise, Jeff

Evgeny Mandrikov

unread,
Feb 5, 2018, 2:50:33 PM2/5/18
to JaCoCo and EclEmma Users

On Friday, January 26, 2018 at 10:00:24 AM UTC+1, jam...@gmail.com wrote:

I wanted to demonstrate the effectiveness of EclEmma to a Japanese audience


First of all - you don't need to measure coverage of classes such as "java.lang.String" for such demonstration, so I would highly advice to not go into unnecessary complexity.


On Thursday, February 1, 2018 at 6:55:20 AM UTC+1, jam...@gmail.com wrote:

Please help/tell me how to run the jacocoagent with "inclbootstrapclasses=true" option?

I am having difficulty running the jacocoagent. I have eclEmma as a plugin for Eclipse4.5, but couldn't find the jacocoagent.jar.


Goal of EclEmma is to hide the need/complexity of direct configuration of agent. And that's why hard to find agent in it.

 

I downloaded the latest jacoco version 080 and tried runnning java -javaagent:[current_path]jacocoagent.jar=inclbootstrapclasses=true, but could not get to run.


What means "could not get to run" ? Execution of

java -javaagent:jacoco-0.8.0/lib/jacocoagent.jar=inclbootstrapclasses=true Main

produces file "jacoco.exec" that contains raw information about coverage of class Main and some classes that won't be in it without "inclbootstrapclasses=true".
Generation of final report from "jacoco.exec" is a separate step: see "report" command in command line interface - http://www.jacoco.org/jacoco/trunk/doc/cli.html , "report" Ant task - http://www.jacoco.org/jacoco/trunk/doc/ant.html , etc
And this is one more example where EclEmma brings simplicity by hiding complexity.

Moreover if you didn't know that JaCoCo library is behind EclEmma and never before used it directly, then please first study its documentation and try basic cases, instead of starting with very advanced option "inclbootstrapclasses" that is marked in documentation as "use with caution".

jam...@gmail.com

unread,
Feb 5, 2018, 7:50:14 PM2/5/18
to JaCoCo and EclEmma Users
Thank you again for your quick reponse Evgeny, I will follow your advice and start with more basic cases.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages