Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
armughan11 committed Sep 25, 2024
1 parent c4393c0 commit 61b0cdc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nullaway/src/main/java/com/uber/nullaway/NullabilityUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ private static boolean isDirectTypeUseAnnotation(
// In JSpecify mode and without the LegacyAnnotationLocations flag, annotations on array
// dimensions are *not* treated as applying to the top-level type, consistent with the JSpecify
// spec.
// Outside of JSpecify mode, annotations which are *not* on the inner type are not treated as
// being
// applied to the inner type. This can be bypassed the LegacyAnnotationLocations flag, in which
// annotations on all locations are treated as applying to the inner type.
// We don't allow mixing of inner types and array dimensions in the same location
// (i.e. `Foo.@Nullable Bar []` is meaningless).
// These aren't correct semantics for type use annotations, but a series of hacky
Expand All @@ -342,15 +346,19 @@ private static boolean isDirectTypeUseAnnotation(
break;
case ARRAY:
if (config.isJSpecifyMode() || !config.isLegacyAnnotationLocation()) {
// Annotations on array element types do not apply to the top-level
// type outside of legacy mode
return false;
}
locationHasArray = true;
break;
default:
// Wildcard or type argument!
return false;
}
}
if (config.isLegacyAnnotationLocation()) {
// Make sure it's not a mix of inner types and arrays for this annotation's location
return !(locationHasInnerTypes && locationHasArray);
}
if (!hasNestedClass(symbol.type)) {
Expand Down

0 comments on commit 61b0cdc

Please sign in to comment.