--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/bf8afb15-7adf-41f5-a854-5c92346c7d43n%40googlegroups.com.
Is it possible to recover it without relying on the class files?
E.g. if I only have the source code, theoretically, I know where the branches are (statically analyzing and identifying IFs, Switches, Exceptions, ...), then I also thereotically should know where the probes have been inserted right?
JaCoCo tracks execution with so called probes. Probes are additional byte code instructions inserted in the original class file which will note when they are executed and report this to the JaCoCo runtime. This process is called instrumentation. To keep the runtime overhead minimal, only a few probes are inserted at "strategic" places. These probe positions are determined by analyzing the control flow of all methods of a class. As a result every instrumented class produces a list of
nboolean flags indicating whether the probe has been executed or not. A JaCoCo*.execfile simply stores a boolean array per class id.At analysis time, for example for report generation, the
*.execfile is used to get information about probe execution status. But as probes are stored in a plain boolean array there is no information like corresponding methods or lines. To retrieve this information we need the original class files and perform the exact same control flow analysis than at instrumentation time. Because this is a deterministic process we get the same probe positions. With this information we can now interfere the execution status of every single instruction and branch of a method. Using the debug information embedded in the class files we can also calculate line coverage.If we would use just slightly different classes at analysis time than at runtime — e.g. different method ordering or additional branches — we would end-up with different probes. For example the probe at index
iwould be in methoda()and not in methodb(). Obviously this will create random coverage results.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/8b9c6f58-51d0-417d-9ba6-6f8ce8dfc0b6n%40googlegroups.com.