Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/AccessorNullityUnderDefaultQualifier.java
Tagir Valeevandintellij-monorepo-bot faa476c41c [java-psi] Fix annotation handling in records
1. Methods on PsiModifierList and PsiModifierListOwner should produce consistent result
2. getAnnotations() should be consistent with hasAnnotation() and findAnnotation/getAnnotation()
3. Compact constructor parameters should also have annotations
4. It's wrong to mix annotations on field type/method return type and annotations on field/method itself. Problems especially arise when component type is an array: in this case, it has separate set of annotations (declared before []). Also, it's unnecessary to filter annotations on type: they are already filtered; only type_use annotations are there.

Fixes IDEA-302340 'Constant values' false positive for record @Nullable array when DefaultQualifier NonNull is used in package-info

GitOrigin-RevId: 39f7bcd8fca652fb50c92c52b95a5d39b4400fc8
2022-12-10 11:46:57 +00:00

12 lines
339 B
Java

import org.checkerframework.checker.nullness.qual.*;
import org.checkerframework.framework.qual.*;
@DefaultQualifier(NonNull.class)
record SimpleRecord(String @Nullable [] nullableArray) {
public static void main() {
SimpleRecord record = new SimpleRecord(null);
if (record.nullableArray() == null) {
// etc...
}
}
}