-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Labels
Description
Sorry if I miss something obvious, but I am not sure why NullAway 0.12.4 with Java 23, JSpecify mode enabled, and @NullMarked
at package level does not report any error for this simple use case:
List<@Nullable String> listOfNullable = new ArrayList<>();
listOfNullable.add("foo");
listOfNullable.add(null);
listOfNullable.add("bar");
for (String element : listOfNullable) {
System.out.println(element.toLowerCase());
}
You can find a related repro on https://github.com/sdeleuze/jspecify-nullway-demo/tree/generics-with-list, where ./gradlew clean build
does not report any error. I see the same behavior with Supplier<@Nullable T>
. IDEA reports a warning as expected.
msridhar