In general, the effect on the coating is the same.
Source code tools can give excellent reporting results , simply because byte code tools cannot distinguish any structure in the source lines, because the granularity of the code block is written only in terms of the source lines.
Suppose I have two nested if statements (or equivalently , if (a & b) ... * ) on the same line. The source code analyzer tool can see them and provide coverage information for several arms within if, within the source line; it can report blocks based on rows and columns. The bytecode tool sees only one line wrapped around conditions. Does the line in the line mean โcoveredโ if condition a is satisfied, but is false?
You can argue that this is a rare circumstance (and it probably is), and therefore not very useful. When you get fictitious coverage and then the field fails, you can change your mind about the utility.
There is a good example and explanation of how byte code coverage makes getting information about switch statements correct , extremely difficult.
The source code analyzer tool can also speed up the execution of tests because it has a compiler that helps optimize the tool code. In particular, a probe inserted inside the loop by a binary can be compiled inside the loop by the JIT compiler. A good Java compiler will see that the hardware produces a loop-dependent result and pulls the measuring hardware out of the loop. (The JIT compiler can do this too, the question is whether they really do this).
Ira Baxter Mar 06 '13 at 23:17 2013-03-06 23:17
source share