-
Notifications
You must be signed in to change notification settings - Fork 299
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
Fix bug with computing direct type use annotations on parameters #864
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,16 +38,28 @@ public void annotationAppliedToTypeParameter() { | |
"import java.util.List;", | ||
"import java.util.ArrayList;", | ||
"import org.checkerframework.checker.nullness.qual.Nullable;", | ||
"import org.checkerframework.checker.nullness.qual.NonNull;", | ||
"class TypeArgumentAnnotation {", | ||
" List<@Nullable String> fSafe = new ArrayList<>();", | ||
" @Nullable List<String> fUnsafe = new ArrayList<>();", | ||
" void useParamSafe(List<@Nullable String> list) {", | ||
" list.hashCode();", | ||
" }", | ||
" void unsafeCall() {", | ||
" // BUG: Diagnostic contains: passing @Nullable parameter", | ||
" useParamSafe(null);", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before this change, this was a false negative? (Either way, great to have the test, but just curious) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that's right, this was a false negative before |
||
" }", | ||
" void useParamUnsafe(@Nullable List<String> list) {", | ||
" // BUG: Diagnostic contains: dereferenced", | ||
" list.hashCode();", | ||
" }", | ||
" void useParamUnsafeNonNullElements(@Nullable List<@NonNull String> list) {", | ||
" // BUG: Diagnostic contains: dereferenced", | ||
" list.hashCode();", | ||
" }", | ||
" void safeCall() {", | ||
" useParamUnsafeNonNullElements(null);", | ||
" }", | ||
" void useFieldSafe() {", | ||
" fSafe.hashCode();", | ||
" }", | ||
|
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.
Needed so that
@NotNull
is a type use annotation