mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
IDEA-74017 Infer @NotNull/@Nullable annotations for final fields from constructor(s)
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Doo {
|
||||
private final Object myA;
|
||||
private final Object myB;
|
||||
|
||||
public Doo(@Nullable Object myA, @NotNull Object myB) {
|
||||
this.myA = myA;
|
||||
this.myB = myB;
|
||||
}
|
||||
|
||||
int foo() {
|
||||
if (<warning descr="Condition 'myB != null' is always 'true'">myB != null</warning> &&
|
||||
<warning descr="Method invocation 'myA.equals(myB)' may produce 'java.lang.NullPointerException'">myA.equals(myB)</warning>) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
return myA.hashCode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user