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
Add filter for exhaustive switch expression #1472
Conversation
643dcfa
to
ae0663f
Compare
ae0663f
to
749871b
Compare
6a99e78
to
f26e464
Compare
org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/ExhaustiveSwitchFilter.java
Outdated
Show resolved
Hide resolved
org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/ExhaustiveSwitchFilter.java
Show resolved
Hide resolved
org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/ExhaustiveSwitchFilter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work again! I left some formal comments you might want to consider.
@Godin should this already handle multi-line switch expressions? I still get missed branch warnings in my code, where I have something like: enum Example {
A, B;
static int example(Example e) {
return switch (e) {
case A -> {
if (false) {
throw new InvalidStateException();
}
yield 1
};
case B -> {
if (false) {
throw new InvalidStateException();
}
yield 2;
};
}
public static void main(String[] args) {
example(A);
example(B);
}
} |
@nioncode for the following
using
execution of
produces the following report |
This is true. Sorry, I ran this through gradle and it seems it does not pick up the latest version by default. Just for others, if you use the jacoco plugin in gradle, you can force a specific version via:
Everything works fine as is, sorry for the noise. |
Before this change for the following
Example.java
using
execution of
produces
and after this change
Fixes #771