Files
Tagir Valeevandintellij-monorepo-bot 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

25 lines
1006 B
Java

import org.jetbrains.annotations.*;
class C {
public static C C = null;
@NotNull public C getC() {return C;}
@NotNull public C getC2() {return C;}
public void f1(@Nullable C p) {}
public void f2(@NotNull C p) {}
public void f3(@Nullable C p) {}
public void f4(@NotNull C p) {}
}
class CC extends C {
<warning descr="Method annotated with @Nullable must not override @NotNull method">@Nullable</warning> public C getC() {return C;}
public C <warning descr="Not annotated method overrides method annotated with @NotNull">getC2</warning>() {return C;}
public void f1(<warning descr="Parameter annotated @NotNull must not override @Nullable parameter">@NotNull</warning> C p) {}
public void f2(@NotNull C p) {}
public void f3(@Nullable C p) {}
public void f4(@Nullable C p) {}
<warning descr="Cannot annotate with both @Nullable and @NotNull">@Nullable</warning> <warning descr="Cannot annotate with both @NotNull and @Nullable">@NotNull</warning> String f() { return null;}
}