We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
File I used SwitchExpressionTarget.java
SwitchExpressionTarget.java
public class SwitchExpressionTarget { private enum E { ZERO, ONE; } private static int target(E e) { int a = -1; switch (e) { case ZERO -> a = 0; case ONE -> a = 1; }; return a; } public static void main(String[] args) { target(E.ZERO); target(E.ONE); } }
By doing:
$ java -version openjdk version "17.0.7" 2023-04-18 LTS OpenJDK Runtime Environment (build 17.0.7+7-LTS) OpenJDK 64-Bit Server VM (build 17.0.7+7-LTS, mixed mode, sharing) $ javac SwitchExpressionTarget.java $ java -javaagent:jacoco-0.8.11/lib/jacocoagent.jar SwitchExpressionTarget $ java -jar jacoco-0.8.11/lib/jacococli.jar \ report jacoco.exec \ --classfiles SwitchExpressionTarget.class \ --sourcefiles . \ --html report
The report must show full coverage
The report shows 1 missed branch
The text was updated successfully, but these errors were encountered:
This
private static int target(E e) { int a = -1; switch (e) { case ZERO -> a = 0; case ONE -> a = 1; }; return a; }
is switch statement and not switch expression.
Exhaustive switch expression is
private static int target(E e) { int a = switch (e) { case ZERO -> 0; case ONE -> 1; }; return a; }
Sorry, something went wrong.
Godin
No branches or pull requests
Steps to reproduce
File I used
SwitchExpressionTarget.java
By doing:
Expected behaviour
The report must show full coverage
Actual behaviour
The report shows 1 missed branch
The text was updated successfully, but these errors were encountered: