IDEA-224546 "Cannot annotate with both @NotNull and @NotNull" warning

GitOrigin-RevId: 28ff56adebd81918856c5a562cda051e52a33c32
This commit is contained in:
Tagir Valeev
2019-10-10 10:34:02 +00:00
committed by intellij-monorepo-bot
parent 3339a4762c
commit c2af9c1d1f
3 changed files with 11 additions and 1 deletions
@@ -334,7 +334,9 @@ public abstract class NullableNotNullManager {
: findAnnotation(owner, qualifiedNames);
PsiType type = getOwnerType(owner);
if (memberAnno != null) {
return preferTypeAnnotation(memberAnno, type);
PsiAnnotation annotation = preferTypeAnnotation(memberAnno, type);
if (annotation != memberAnno && !qualifiedNames.contains(annotation.getQualifiedName())) return null;
return annotation;
}
if (type != null) {
return ContainerUtil.find(type.getAnnotations(), a -> qualifiedNames.contains(a.getQualifiedName()));
@@ -0,0 +1,3 @@
interface Y {
@withTypeUse.Nullable Object @withTypeUse.NotNull [] arr();
}
@@ -69,6 +69,11 @@ public class NullableStuffInspectionTest extends LightJavaCodeInsightFixtureTest
doTest();
}
public void testAnnotatingArrayAmbiguous() {
DataFlowInspection8Test.setupAmbiguousAnnotations("withTypeUse", myFixture);
doTest();
}
public void testProblems2() { doTest(); }
public void testNullableFieldNotnullParam() { doTest(); }
public void testNotNullFieldNullableParam() { doTest(); }