Hi Echo,
Eclipse EclEmma plugin ( http://www.eclemma.org/ ) is based on JaCoCo
library ( http://www.eclemma.org/jacoco/index.html ) that takes information
about lines from bytecode. And bytecode is generated by a Java compiler.
Decompilation of your class files by command "javap -v -p" shows that
"Hello.class" has following constructor and method and lines associated
with them (output of command was trimmed to leave only relevant
information):
public Hello();
LineNumberTable:
line 3
line 4
line 5
line 6
public void testGoto(int);
LineNumberTable:
line 10
line 11
line 12
line 13
line 15
and "HelloTest.class" has following constructor and method and lines
associated with them:
public HelloTest();
LineNumberTable:
line 1
public static void main(java.lang.String[]);
LineNumberTable:
line 4
line 5
>From there you can see that *compiler *:
- did not saved in bytecode numbers of lines with method names and
that's why they all are not highlighted
- line number of "public class HelloTest" has been saved as line of
implicitly generated constructor, which is never called, and that's why it
is highlighted as red
- there is no implicitly generated constructor in "public class Hello"
and that's why this line is not highlighted
- line number of "public Hello(){" has been saved as line of explicit
non-generated constructor, which is called, and that's why it is
highlighted as green
All in all - there is no any "phenomenon", EclEmma shows lines that are
saved in bytecode by compiler.
Regards,
Evgeny
On Saturday, November 25, 2017 at 9:05:32 AM UTC+1, Echo wrote:
>
> Hi Marc
> Case 1: "As the HelloTest is probably never instantiated this line is red".
> The line is red because HelloTest Class is never Instantiated. So why Hello
> Line doesn't have any color(red or green)?
> Case 2: All the constructor function is green or red. But the
> normal function line doesn't have any color.
> About the version: I use both eclipse(eclemma) and ant to check
> the phenomenon. The corresponding file are in the attachment.
>
>
> 在 2017年11月24日星期五 UTC+8下午11:13:43,Marc R. Hoffmann写道:
>>
>> Hi Echo,
>>
>> Case 1: This is the implicit default constructor added by the Java
>> compiler. As the HelloTest is probably never instantiated this line is red.
>>
>> Case 2: I don't have an explanation here. What exact compiler version are
>> you using (Eclipse)? Can you please provide the corresponding class file
>> for further analysis?
>>
>> Regards,
>> -marc
>>
>>
>>
>>
>>
>>
>>
>> On 2017-11-24 08:20, Echo wrote:
>>
>> Hi, All. When i use jacoco to run the code, the report seems
>> incorrect and makes me confused.
>> 1. About the class name line.
>> As you can see in the picture, the first line in HelloTest is red and the
>> first line in the Hello isn't red. But both classes have been executed.
>> 2.About the method name line.
>> In Hello class, line 3 is green while line 9 doesn't have any color. Is
>> it because line 3 is INIT Method.
>>
>>
>> <https://lh3.googleusercontent.com/-9Dh5VZNWKgs/WhfHwkpZ9XI/AAAAAAAAACY/3ItVsoL5HWQCzRwJH0vMV14G7g9OhIRuQCLcBGAs/s1600/F5%25253D7%257B2PZQ%257EZ6UCX62ZA5I.png>
>>
>>
>> <https://lh3.googleusercontent.com/-sqqNXxGAYUo/WhfH0QN41bI/AAAAAAAAACc/TKGQxoqS4gc0xi6-y5BMua1hRGUJsstfACLcBGAs/s1600/5DKEW%255BG%2540J%257EZ%2540NDKSU%2540%2528N_PD.png>
>>
>>
>> Regrads
>> Echo
>>
>>
>> --
>> 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/ac8f339e-ce47-4de9-9017-d86a3e421639%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jacoco/ac8f339e-ce47-4de9-9017-d86a3e421639%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit 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/279ad1a6-0238-4e7b-a7fa-ad8ecff5bee6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.