Files
openide/java/java-tests/testData/inspection/nullableProblems/Problems.java
Tagir Valeev 33e0062392 [java-inspection] Rewrite annotation checking
Now start from annotations instead of type element or owner (process owners for external annotations only)
Also, prefer TYPE_USE when reporting on primitive types

GitOrigin-RevId: 90771f89eb68ed1446afa9bbfc9cc7938c321d26
2020-09-07 07:19:55 +00:00

27 lines
1.3 KiB
Java

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class B {
public void f(@NotNull String p){}
@NotNull
public String nn(@Nullable String param) {
return "";
}
}
class Y extends B {
<warning descr="Cannot annotate with both @NotNull and @Nullable">@NotNull</warning> <warning descr="Cannot annotate with both @Nullable and @NotNull">@Nullable</warning> String s;
public void f(String <warning descr="Not annotated parameter overrides @NotNull parameter">p</warning>){}
public String <warning descr="Not annotated method overrides method annotated with @NotNull">nn</warning>(<warning descr="Parameter annotated @NotNull must not override @Nullable parameter">@NotNull</warning> String param) {
return "";
}
void p(<warning descr="Cannot annotate with both @NotNull and @Nullable">@NotNull</warning> <warning descr="Cannot annotate with both @Nullable and @NotNull">@Nullable</warning> String p2){}
<warning descr="Primitive type members cannot be annotated">@Nullable</warning> int f;
<warning descr="Primitive type members cannot be annotated">@NotNull</warning> void vf(){}
void t(<warning descr="Primitive type members cannot be annotated">@NotNull</warning> double d){}
}