Skip to content

Commit

Permalink
Merge branch 'master' into 2024-12-21-synchronized-deref
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar authored Dec 22, 2024
2 parents f59e15a + d0502e8 commit 325daa3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void testModuleInfo() {
defaultCompilationHelper
.addSourceLines(
"module-info.java",
"@SuppressWarnings(\"some-warning-name\")",
"module com.uber.mymodule {",
" // Important: two-level deep module tests matching of identifier `java` as base expression;",
" // see further discussion at https://github.com/uber/NullAway/pull/544#discussion_r780829467",
Expand Down
6 changes: 6 additions & 0 deletions nullaway/src/main/java/com/uber/nullaway/NullAway.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ public Description matchAssignment(AssignmentTree tree, VisitorState state) {
doUnboxingCheck(state, tree.getExpression());
}
Symbol assigned = ASTHelpers.getSymbol(tree.getVariable());
if (assigned instanceof Symbol.MethodSymbol) {
// javac generates an AssignmentTree for setting an annotation attribute value. E.g., for
// `@SuppressWarnings("foo")`, javac generates an AssignmentTree of the form `value() =
// "foo"`, where the LHS is a MethodSymbol. We don't want to analyze these.
return Description.NO_MATCH;
}
if (assigned != null && codeAnnotationInfo.isSymbolUnannotated(assigned, config, handler)) {
// assigning to symbol that is unannotated
return Description.NO_MATCH;
Expand Down

0 comments on commit 325daa3

Please sign in to comment.