https://www.jacoco.org/jacoco/trunk/doc/classids.html 
<https://www.jacoco.org/jacoco/trunk/doc/classids.html>

What can cause different class ids?

Class ids are identical for the exact same class file only (byte-by-byte). 
There is a couple of reasons why you might get different class files. First 
compiling Java source files will result in different class files if you use a 
different tool chain:

Different compiler vendor (e.g. Eclipse vs. Oracle JDK)
Different compiler versions
Different compiler settings (e.g. debug vs. non-debug)
Also post-processing class files (obfuscation, AspectJ, etc.) will typically 
change the class files. JaCoCo will work well if you simply use the same class 
files for runtime as well as for analysis. So the tool chain to create these 
class files does not matter.

Even if the class files on the file system are the same there is possible that 
classes seen by the JaCoCo runtime agent are different anyways. This typically 
happens when another Java agent is configured before the JaCoCo agent or 
special class loaders pre-process the class files. Typical candidates are:

Mocking frameworks
Application servers
Persistence frameworks





> On 28. Apr 2023, at 06:50, falin luo <meilide...@gmail.com> wrote:
> 
> Hi, 
> I have seen the documentation. But in my view, I think that the classid just 
> identifies a unique class. So, when modifying CRC to change the way of 
> identification, the class files should be the same between instrumentation 
> and analysis.
> Or I still don't understand the reason why using the total byte code to 
> encode the classic?  Or how the classes could be different between 
> instrumentation and analysis, can you give me an example? 
> 
> Thanks,
> Lin
> 
> 在2023年4月26日星期三 UTC+8 13:23:04<Marc R. Hoffmann> 写道:
> Hi,
> 
> yes, your modification breaks JaCoCo because then class files might be 
> different between intrumentation and analysis. Please see chapter “Why can't 
> JaCoCo simply use the class name to identify classes?” in the documentation:
> 
> https://www.jacoco.org/jacoco/trunk/doc/classids.html 
> <https://www.jacoco.org/jacoco/trunk/doc/classids.html>
> 
> 
> Regards,
> -marc
> 
> 
> 
> 
>> On 24. Apr 2023, at 11:35, falin luo <meili...@gmail.com 
>> <applewebdata://EF82651A-BA20-437C-ADB4-93FCC9A1E72F>> wrote:
>> 
> 
>> Hi:
>> I want to modify the CRC to identify the class only by class name, like 
>> https://github.com/MEILIDEKCL/jacoco-dev/blob/dev-lfl/org.jacoco.core/src/org/jacoco/core/internal/data/CRC64.java
>>  
>> <https://github.com/MEILIDEKCL/jacoco-dev/blob/dev-lfl/org.jacoco.core/src/org/jacoco/core/internal/data/CRC64.java>.
>> 
>> And I tested it, but I get the wrong information below:
> 
>> <屏幕截图 2023-04-24 173233.png>
>> I wonder if it's because I modified the code causing the array overflow.
>> If so, what should I do, or how to change the source code?
>> 
>> Thanks!
>> 
> 
>> -- 
>> 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+un...@googlegroups.com 
>> <applewebdata://EF82651A-BA20-437C-ADB4-93FCC9A1E72F>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jacoco/5e6cac41-4494-4cae-ab78-1431243e7dfdn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jacoco/5e6cac41-4494-4cae-ab78-1431243e7dfdn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> <屏幕截图 2023-04-24 173233.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 
> <mailto:jacoco+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/5ddaaf3e-900b-4b02-828b-c8bd94b3c2edn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/5ddaaf3e-900b-4b02-828b-c8bd94b3c2edn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/8F71DA3A-FDBD-481F-8C17-F1A2A5D86AA7%40mountainminds.com.

Reply via email to