Thank you very much, this helps me, and I simply make a summary and hope to 
help others.

If anybody wants to get the line coverage, the class files must contain 
line number attributes. For my use scenario, without line number attributes 
lead that iCoverageNode.getLineCounter().getCoveredCount() always return 0. How 
to check if class files contain the line number attributes please refer to 
https://groups.google.com/d/msg/jacoco/d-30r6hVrV4/d_3Dk3GdCgAJ. 

If you just want to get coverage of other metrics, it will not be affected 
by the missing line number.

在 2019年1月6日星期日 UTC+8上午10:01:48,Evgeny Mandrikov写道:
>
>
>
> On Saturday, January 5, 2019 at 4:29:03 PM UTC+1, Tool Ply wrote:
>>
>> According to 
>> https://groups.google.com/d/msg/jacoco/d-30r6hVrV4/d_3Dk3GdCgAJ, this 
>> was indeed because of that the decompiled classes has no LineNumberTable.
>>
>> So, while the document says " To calculate line coverage class files 
>> must contain line number attributes. ", is this possible to get method 
>> coverage without line numbers?
>>
>
> Without line numbers except line counters everything else will be 
> calculated ( https://www.jacoco.org/jacoco/trunk/doc/counters.html ) - 
> for example given Example.java
>
> class Example {
>   public static void main(String[] args) {
>     if (args.length == 0) {
>       System.out.println("Hello, World!");
>     } else {
>       System.out.println("Hello, " + args[0] + "!");
>     }
>   }
> }
>
> execution of
>
> javac -g:none Example.java
>
> will produce class without debug information. And execution of
>
> java -javaagent:jacoco-0.8.2/lib/jacocoagent.jar Example
> java -jar jacoco-0.8.2/lib/jacococli.jar report jacoco.exec --classfiles 
> Example.class --html report
>
> will produce following report
>
> [image: 1.png]
>
>
> [image: 2.png]
>
>
>
> [image: 3.png]
>
>
>
>

-- 
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 jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/aca3190d-a78e-4655-8c80-d5349bebf1f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to