Skip to content

Commit

Permalink
Fixes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
lazaroclapp committed Jan 3, 2023
1 parent 0adb703 commit bf3fdb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,23 +308,23 @@ private static boolean isDirectTypeUseAnnotation(Attribute.TypeCompound t) {
// proper deprecation of the incorrect behaviors for type use annotations when their
// semantics don't match those of a declaration annotation in the same position.
// See https://github.com/uber/NullAway/issues/708
boolean location_has_inner_types = false;
boolean location_has_array = false;
boolean locationHasInnerTypes = false;
boolean locationHasArray = false;
for (TypePathEntry entry : t.position.location) {
switch (entry.tag) {
case INNER_TYPE:
location_has_inner_types = true;
locationHasInnerTypes = true;
break;
case ARRAY:
location_has_array = true;
locationHasArray = true;
break;
default:
// Wildcard or type argument!
return false;
}
}
// Make sure it's not a mix of inner types and arrays for this annotation's location
return !(location_has_inner_types && location_has_array);
return !(locationHasInnerTypes && locationHasArray);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public void typeUseAnnotationOnInnerMultiLevel() {
"import org.checkerframework.checker.nullness.qual.Nullable;",
"class A { class B { class C {} } }",
"class Test {",
" // At some point, we should not treat foo1, foo2, or foo4 as @Nullable.",
" // At some point, we should not treat foo1 or foo2 as @Nullable.",
" // For now we do, for ease of compatibility.",
" // TODO: Fix this as part of https://github.com/uber/NullAway/issues/708",
" @Nullable A.B.C foo1 = null;",
Expand Down

0 comments on commit bf3fdb4

Please sign in to comment.