mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] handleClosure: fix escaping of 'this'
Regression introduced in IDEA-361818 GitOrigin-RevId: faed510b342995f19cbee5d56138132c7c209662
This commit is contained in:
committed by
intellij-monorepo-bot
parent
467aef7509
commit
1b10ecf7f1
+3
@@ -806,6 +806,9 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
if (descriptor != null) {
|
||||
descriptors.add(descriptor);
|
||||
}
|
||||
if (JavaDfaValueFactory.getQualifierOrThisValue(myFactory, expression) instanceof DfaVariableValue dfaVar) {
|
||||
descriptors.add(dfaVar.getDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
class FieldWriteInLambda {
|
||||
private String myField;
|
||||
|
||||
FieldWriteInLambda(boolean b) {
|
||||
BooleanSupplier r = () -> {
|
||||
myField = Math.random() > 0.5 ? "foo" : <warning descr="Assigning 'null' value to non-annotated field">null</warning>;
|
||||
return myField != null;
|
||||
};
|
||||
if (b) {
|
||||
r.getAsBoolean();
|
||||
if (myField == null) {
|
||||
|
||||
}
|
||||
} else if (r.getAsBoolean()) {
|
||||
if (myField == null) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,4 +379,5 @@ public class DataFlowInspection8Test extends DataFlowInspectionTestCase {
|
||||
setupTypeUseAnnotations("typeUse", myFixture);
|
||||
doTest();
|
||||
}
|
||||
public void testFieldWriteInLambda() { doTest(); }
|
||||
}
|
||||
Reference in New Issue
Block a user