NullableStuffInspectionBase: avoid reporting primitive type if annotation is inherited (IDEA-232026)

GitOrigin-RevId: 302234236e4d33882f81ed17f1cbe60ef13bea23
This commit is contained in:
Tagir Valeev
2020-02-04 19:11:20 +07:00
committed by intellij-monorepo-bot
parent e674727abc
commit aa3c4138ae

View File

@@ -599,7 +599,9 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
}
if ((notNull != null || nullable != null) && type != null && TypeConversionUtil.isPrimitive(type.getCanonicalText())) {
PsiAnnotation annotation = notNull == null ? nullable : notNull;
reportPrimitiveType(holder, annotation, listOwner);
if (listOwner == null || !annotation.isPhysical() || annotation.getOwner() == listOwner.getModifierList()) {
reportPrimitiveType(holder, annotation, listOwner);
}
}
if (listOwner instanceof PsiParameter) {
checkLoopParameterNullability(holder, notNull, nullable, DfaPsiUtil.inferParameterNullability((PsiParameter)listOwner));