Skip to content

Commit

Permalink
rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Feb 25, 2025
1 parent bbfd36c commit 1aa9747
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public static boolean mayBeNullFieldFromType(
return !(symbol.getSimpleName().toString().equals("class")
|| symbol.isEnum()
|| codeAnnotationInfo.isSymbolUnannotated(symbol, config, null))
&& Nullness.hasNullableFieldAnnotation(symbol, config);
&& Nullness.hasNullableOrMonotonicNonNullAnnotation(symbol, config);
}

/**
Expand Down
11 changes: 6 additions & 5 deletions nullaway/src/main/java/com/uber/nullaway/Nullness.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,15 @@ public static boolean isMonotonicNonNullAnnotation(String annotName) {
}

/**
* For a field check for either a {@code @Nullable} annotation or a {@code @MonotonicNonNull}
* annotation
* Check for either a {@code @Nullable} annotation or a {@code @MonotonicNonNull} annotation on
* {@code symbol}. Used to reason whether a field may be null.
*/
public static boolean hasNullableFieldAnnotation(Symbol symbol, Config config) {
return hasNullableFieldAnnotation(NullabilityUtil.getAllAnnotations(symbol, config), config);
public static boolean hasNullableOrMonotonicNonNullAnnotation(Symbol symbol, Config config) {
return hasNullableOrMonotonicNonNullAnnotation(
NullabilityUtil.getAllAnnotations(symbol, config), config);
}

private static boolean hasNullableFieldAnnotation(
private static boolean hasNullableOrMonotonicNonNullAnnotation(
Stream<? extends AnnotationMirror> annotations, Config config) {
return annotations
.map(anno -> anno.getAnnotationType().toString())
Expand Down

0 comments on commit 1aa9747

Please sign in to comment.