Skip to content

Commit 0fc9146

Browse files
cpovirkError Prone Team
authored and
Error Prone Team
committed
Recognize libcore.util.Nullable as type-use, and add a TODO about "hybrid" annotations.
PiperOrigin-RevId: 407607800
1 parent 0f34024 commit 0fc9146

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullnessUtils.java

+5
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,12 @@ private static NullableAnnotationToUse pickNullableAnnotation(VisitorState state
237237
}
238238

239239
private static boolean isTypeUse(String className) {
240+
/*
241+
* TODO(b/205115472): Make this tri-state ({type-use, declaration, both}) and avoid using "both"
242+
* annotations in any cases in which they would be ambiguous (e.g., arrays/elements).
243+
*/
240244
switch (className) {
245+
case "libcore.util.Nullable":
241246
case "org.checkerframework.checker.nullness.qual.Nullable":
242247
case "org.jspecify.nullness.Nullable":
243248
return true;

0 commit comments

Comments
 (0)