Files
openide/java/java-tests/testData/inspection/nullableProblems/DisableOnLocals.java
Tagir Valeevandintellij-monorepo-bot ca9649997b [java-inspections] Properly report 'not applicable on locals' warnings
IDEA-355699 Warning when annotating array elements as nullable with JSpecify

GitOrigin-RevId: ca9a3e0ea2ef3aa01d31afcaff2f92193af14dbe
2024-09-25 11:10:24 +00:00

16 lines
720 B
Java

import org.jspecify.annotations.Nullable;
import java.util.List;
class Demo {
public void demo() {
<warning descr="Nullability annotation is not applicable to local variables">@Nullable</warning> String str;
<warning descr="Nullability annotation is not applicable to local variables">@Nullable</warning> List<@Nullable String> list;
@Nullable Boolean[] array1 = new Boolean[]{true, false, null};
Boolean <warning descr="Nullability annotation is not applicable to local variables">@Nullable</warning> [] array2 = null;
Boolean <warning descr="Nullability annotation is not applicable to local variables">@Nullable</warning> [] [] array3 = null;
Boolean [] @Nullable [] array4 = null;
}
}