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 code:
import org.checkerframework.checker.nullness.qual.PolyNull; class Demo { public static @PolyNull String toLowerCaseA(@PolyNull String text) { return text == null ? null : text.toLowerCase(); } public static @PolyNull String toLowerCaseB(@PolyNull String text) { return text != null ? text.toLowerCase() : null; } }
The two methods perform the same thing, just with flipped logic. However, for toLowerCaseB we get an error:
toLowerCaseB
Error: [conditional.type.incompatible] incompatible types in conditional expression. found : null (NullType) required: @Initialized @NonNull String
The text was updated successfully, but these errors were encountered:
A small question: why is the type of conditional expression text == null ? null : text.toLowerCase() is @Initialized @PolyNull String at first?
text == null ? null : text.toLowerCase()
@Initialized @PolyNull String
Sorry, something went wrong.
add eisop#519 to CHANGELOG
48789dd
Successfully merging a pull request may close this issue.
Take this code:
The two methods perform the same thing, just with flipped logic.
However, for
toLowerCaseB
we get an error:The text was updated successfully, but these errors were encountered: