Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/ConstantInClosure.java
Tagir Valeev 1c366664e9 [java-dfa] Avoid flushing constants before closures
LiveVariableAnalyzer should know that the constant is used in closure. Otherwise, it may flush it.
Fixes IDEA-262325 Nullability issue when constant checked outside of lambda is used inside

GitOrigin-RevId: 660beecec912efbaceec77e71bfcfbca43fd97ad
2021-02-19 05:54:18 +00:00

22 lines
422 B
Java

import org.jetbrains.annotations.*;
public class ConstantInClosure {
static final Object CONST = init();
private void test() {
Obj obj = new Obj();
if (CONST != null) {
privateMethod();
Runnable runnable = () -> consume(CONST);
}
}
private void privateMethod() { }
native void consume(@NotNull Object obj);
@Nullable
static native Object init();
private static class Obj { }
}