make AnnotationUtil.findOwnAnnotation skip type annotations inapplicable to declarations (IDEA-CR-47125, IDEA-210087)

GitOrigin-RevId: 677b8286169bda976caab66a18881729182c7e04
This commit is contained in:
peter
2019-05-14 15:08:45 +03:00
committed by intellij-monorepo-bot
parent 6e57ba824d
commit 02fcb39a75
7 changed files with 51 additions and 12 deletions
@@ -2,7 +2,7 @@ import foo.*;
class IgnoreNullabilityOnPrimitiveCast {
private static int map(@Nullable int[] mapping, int idx) {
return <warning descr="Array access 'mapping[idx]' may produce 'NullPointerException'">mapping[idx]</warning>;
return mapping[idx];
}
static final int TEST;
@@ -1,15 +1,28 @@
import foo.Nullable;
class Bar {
private @Nullable Object[] typeUseAmbiguity(Object o) {
@Nullable Object[] a = (@Nullable Object[]) o;
private @mixed.Nullable Object[] typeUseAmbiguity(Object o) {
@mixed.Nullable Object[] a = (@mixed.Nullable Object[]) o;
if (a == null) {
throw new NullPointerException();
}
return a;
}
private @<warning descr="@Nullable method 'noAmbiguity' always returns a non-null value">Nullable</warning> Object noAmbiguity(Object o) {
private @<warning descr="@Nullable method 'noAmbiguity' always returns a non-null value">mixed.Nullable</warning> Object noAmbiguity(Object o) {
if (o == null) {
throw new NullPointerException();
}
return o;
}
private @typeUse.Nullable Object[] typeUseArray(Object o) {
@typeUse.Nullable Object[] a = (@typeUse.Nullable Object[]) o;
if (a == null) {
throw new NullPointerException();
}
return a;
}
private @<warning descr="@Nullable method 'typeUsePlain' always returns a non-null value">typeUse.Nullable</warning> Object typeUsePlain(Object o) {
if (o == null) {
throw new NullPointerException();
}