-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Preceeding if block leads to partial instruction coverage on while statement (ECJ only) #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
To me this looks like artifact of ECJ compiler: class Fun {
void fun(boolean b) {
if (b) {
System.out.println("then");
} else {
System.out.println("else");
}
while (b) { // line 9
System.out.println("while");
}
}
} ECJ 4.6.2 generates
where |
@marchof in fact I did this investigation prior to #503 (comment) , excuse me for a scarce comment. And my proposal in #504 (comment) was to preserve test of this interesting case maybe even with detailed explanation of why this happens at least to be able to refer to it in case of questions like "why such coverage is shown". |
@marchof I'd like to reopen this as a request for enhancement: As was said earlier - case is quite interesting and IMO deserves place in our validation tests. Furthermore in a filter for |
@Godin Interesting idea to remove all |
301d4cc
to
431d0f0
Compare
@marchof unfortunately I completely forgot that |
While inserting compiler specific tests in our validation tests it turned out that for ECJ we get different coverage results for a while block when there is a preceeding if/else block.
Test target:
jacoco/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target01.java
Line 46 in 47094b8
Test verification:
jacoco/org.jacoco.core.test/src/org/jacoco/core/test/validation/ControlStructuresTest.java
Line 44 in 47094b8