mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-44118 Possible NPE from @Nullable isn't flagged in synchronized() statement
This commit is contained in:
@@ -606,7 +606,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
PsiExpression lock = statement.getLockExpression();
|
||||
if (lock != null) {
|
||||
lock.accept(this);
|
||||
addInstruction(new PopInstruction());
|
||||
addInstruction(new FieldReferenceInstruction(lock, "Synchronized value"));
|
||||
}
|
||||
|
||||
addInstruction(new FlushVariableInstruction(null));
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BrokenAlignment {
|
||||
|
||||
void test(@Nullable Object n) {
|
||||
synchronized (<warning descr="Dereference of 'n' may produce 'java.lang.NullPointerException'">n</warning>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,4 +85,6 @@ public class DataFlowInspectionFixtureTest extends JavaCodeInsightFixtureTestCas
|
||||
|
||||
public void testAssigningUnknownToNullable() throws Throwable { doTest(); }
|
||||
|
||||
public void testSynchronizingOnNullable() throws Throwable { doTest(); }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user