Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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);
}

// Class-level @SuppressWarnings("nullness") should override a method-level
// @AnnotatedFor("nullness")
@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)) {
// 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);
}
}

// Class-level @SuppressWarnings("subtyping") should override a method-level
// @AnnotatedFor("subtyping")
@SuppressWarnings("subtyping")
class SuppressWarningsClassWithAnnotatedForMethod {
@AnnotatedFor("subtyping")
@SubQual Object m(@SuperQual Object p) {
return p;
}
}
}
Loading