I recently generated a Jacoco (0.8.5) code coverag...
# code-coverage
p
I recently generated a Jacoco (0.8.5) code coverage report for the Jetpack Compose sample app, JetNews, and
lateinit
was marked in yellow. Hovering revealed both cases were missed. I seem to recall not seeing this behavior in less experimental code. Two questions: 1) is Jacoco doing the right thing for your uses of
lateinit
statements? 2) should the code coverage tool even care about
lateinit
? I think not because it is the accesses that are relevant and important to execute. Note that code coverage is not the right tool to ensure that using un-initialized variables are caught. That state can happen at runtime and be missed by a 100% code coverage run. Therefore knowing that no test tripped an un-initialised execution is not helpful.
1. For the record, I tested
lateinit
with Jacoco 0.8.5 and IntelliJ 2020.2 and both worked as expected thus indicting (no surprise) Compose. But it is way too early to press the case with Compose yet. 2. I'm convinced that
lateinit
statements should not be marked in CCP and no bugs should be filed against Jacoco or IntelliJ because of the different approaches being used.