API Usage Examples

getCount() in jacoco does not mean the number of times a method / line is executed. For method, it only has two values, 0 or 1, means covered or not. For line, it means the number of executed instructions (bytecode level) in that line. For example,

return (i > 0) && (i & (i - 1)) == 0;

This line has 12 instructions, getCount() of this line is a number between 0 and 12 0: iload_0 1: ifle 14 4: iload_0 5: iload_0 6: iconst_1 7: isub 8: iand 9: ifne 14 12: iconst_1 13: ireturn 14: iconst_0 15: ireturn

Jacoco instrument standard library https://stackoverflow.com/questions/67252389/unit-test-coverage-on-java-lang-classes-with-jacoco

java -jar ~/projects/inlinegen-research/jars/org.jacoco.cli-0.8.8-nodeps.jar report target/jacoco.exec --html ./report --classfiles $JAVA_HOME/jre/lib/

Jacoco ICounter

0: empty

1: not covered

2: fully covered

3: partly covered

JaCoCo 0.8.9.202303170414 API