Java Code Coverage mechanics
summary
Explains how JaCoCo measures coverage by bytecode instrumentation rather than profiling, inserting boolean array probes per method edge and storing execution hits in an execution-data file; shows the on-the-fly approach via a Java agent transformer that rewrites classes at load time, the tiny four-instruction probes, and deterministic probe indexing so report generation replays analysis. Covers synthetic-member handling, bad static-initialization cycles (classes and interfaces) and the runtime workarounds (init helper, injected Object field), the ASM-version workaround for Java 9 class files, and real bug reports filed against OpenJDK.
AI-written summary · about
chapters (20)
- 0:00Intro
- 2:04Real Disclaimer
- 4:58Observer Effect
- 5:49Code Coverage
- 8:03JaCoCo Works on Class Files
- 10:48Java Byte Code Instrumentation
- 12:02Probe Strategies
- 14:16JaCoCo Validation Test Suite
- 19:33How to get probes[] ?
- 21:05Bytecode of Assertions
- 24:25Bridge Methods
- 26:16Methods in Enums
- 27:18Lambdas
- 33:49Java Virtual Machine Specification
- 36:26Java Language Specification
- 42:06Bad Cycle with Interfaces - Solution
- 43:46Runtime Access - Problem
- 44:51Runtime Access - Solution
- 47:21ASM and Java 9
- 50:41Future Bytecode Versions
