BytecodeAnalysis: infer @NotNull for static final fields (for now: non-branching clinit only)

Fixes IDEA-223861 Infer static field nullability from the bytecode

GitOrigin-RevId: 2ee3102df5677e567defbe849900769237a728bc
This commit is contained in:
Tagir Valeev
2019-10-02 10:07:03 +00:00
committed by intellij-monorepo-bot
parent 5e86efe5f2
commit 79cc904ff9
25 changed files with 1568 additions and 384 deletions
@@ -0,0 +1,22 @@
package bytecodeAnalysis.data;
import bytecodeAnalysis.ExpectNotNull;
import bytecodeAnalysis.ExpectContract;
public class TestField {
@ExpectNotNull
public static final Object O1 = new Object();
@ExpectNotNull
public static final Object O2 = getObject();
@ExpectNotNull
public static final Runnable O3 = () -> {};
public static Object O4 = new Object(); // non-final
public final Object O5 = new Object(); // non-static
@ExpectNotNull
@ExpectContract(value="->new",pure=true)
private static Object getObject() {
return new Object();
}
}