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
Take this example:
class SwitchRedundantNullCase { void foo(Object o) { // :: (nulltest.redundant) if (o == null) { System.out.println("o is null"); } switch(o) { case Number n: System.out.println("Number: " + n); break; // :: (nulltest.redundant) case null: System.out.println("null"); break; default: System.out.println("anything else"); } } }
When we run ./checker/bin/javac -processor nullness SwitchRedundantNullCase.java -Alint=redundantNullComparison we get:
./checker/bin/javac -processor nullness SwitchRedundantNullCase.java -Alint=redundantNullComparison
RedundantSwitchOnNull.java:4: warning: [nulltest.redundant] redundant test against null; "o" is non-null if (o == null) { ^ 1 warning
We should also get a warning about a case null when the expression is non-null.
case null
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Take this example:
When we run
./checker/bin/javac -processor nullness SwitchRedundantNullCase.java -Alint=redundantNullComparison
we get:We should also get a warning about a
case null
when the expression is non-null.The text was updated successfully, but these errors were encountered: