Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2a48175
Add SuppressWarnings classes with AnnotatedFor methods
aosen-xiong May 4, 2026
66e664f
Remove redundant check for AnnotatedFor in SourceChecker
aosen-xiong May 4, 2026
90c6889
Remove redundant check for AnnotatedFor in SourceChecker
aosen-xiong May 5, 2026
87b149f
Apply suggestions from code review
aosen-xiong May 5, 2026
19dfafc
Apply formatter
aosen-xiong May 5, 2026
ca073e6
Enhance documentation and logic for @AnnotatedFor and @SuppressWarnin…
aosen-xiong May 11, 2026
569903b
Merge branch 'master' into fix-annotatedfor-warning
aosen-xiong May 11, 2026
f63127a
Merge branch 'master' into fix-annotatedfor-warning
aosen-xiong May 13, 2026
da31816
Merge branch 'master' into fix-annotatedfor-warning
wmdietl May 15, 2026
f11ee59
Merge branch 'master' into fix-annotatedfor-warning
wmdietl May 15, 2026
2d93fb8
Merge branch 'master' into fix-annotatedfor-warning
aosen-xiong May 18, 2026
8e85969
Merge branch 'master' into fix-annotatedfor-warning
wmdietl Jun 5, 2026
2844c1c
Merge branch 'master' into fix-annotatedfor-warning
wmdietl Jun 8, 2026
5963c8e
Clarify AnnotatedFor warning suppression docs
aosen-xiong Jun 19, 2026
e747ab5
Refine suppression lookup for AnnotatedFor
aosen-xiong Jun 19, 2026
f7ea97b
Merge branch 'master' into fix-annotatedfor-warning
aosen-xiong Jun 19, 2026
a481619
Clarify SuppressWarnings scope docs
aosen-xiong Jun 19, 2026
a82e290
Refine AnnotatedFor suppression wording
aosen-xiong Jun 19, 2026
c4fb0fa
Merge branch 'master' into fix-annotatedfor-warning
wmdietl Jul 17, 2026
1e400ff
Add failing test for shouldSuppressWarnings(Element) issue
wmdietl Jul 17, 2026
19b2e07
Fix shouldSuppressWarnings(Element) AnnotatedFor behavior and update …
wmdietl Jul 17, 2026
dd4e56f
Document element suppression tests
aosen-xiong Jul 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,14 @@ void bar() {
annotatedForNullness(initializedField);
annotatedForNullnessAndInitialization(initializedField);
}

// @SuppressWarnings("nullness") should suppress all nullness diagnostics within the annotated
// declaration's scope, including those in nested @AnnotatedFor("nullness") scopes.
@SuppressWarnings("nullness")
class SuppressWarningsClassWithAnnotatedForMethod {
@AnnotatedFor("nullness")
@NonNull Object m() {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2875,11 +2875,6 @@ public boolean shouldSuppressWarnings(Element elt, String errKey) {
return true;
}
}
if (isAnnotatedForThisCheckerOrUpstreamChecker(elt)) {
Comment thread
aosen-xiong marked this conversation as resolved.
// Return false immediately. Do NOT check for AnnotatedFor in the
// enclosing elements, because they may not have an @AnnotatedFor.
return false;
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,14 @@ static class staticAnnotatedAndWarningsSuppressedClass {
so4 = staticUnannotatedMethod(so1);
}
}

// @SuppressWarnings("subtyping") should suppress all subtying diagnostics within the annotated
// declaration's scope, including those in nested @AnnotatedFor("subtyping") scopes.
@SuppressWarnings("subtyping")
class SuppressWarningsClassWithAnnotatedForMethod {
@AnnotatedFor("subtyping")
@SubQual Object m(@SuperQual Object p) {
return p;
}
}
}
Loading