mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: method can still return unknown value if its arguments satisfy nullity conditions (IDEA-106205)
This commit is contained in:
@@ -1347,6 +1347,17 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
} else if (type == ConditionChecker.Type.IS_NULL_METHOD || type == ConditionChecker.Type.IS_NOT_NULL_METHOD) {
|
||||
addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
|
||||
addInstruction(new BinopInstruction(type == ConditionChecker.Type.IS_NULL_METHOD ? JavaTokenType.EQEQ : JavaTokenType.NE, null, expression.getProject()));
|
||||
|
||||
ConditionalGotoInstruction ifFails = new ConditionalGotoInstruction(-1, true, null);
|
||||
GotoInstruction gotoEnd = new GotoInstruction(exitPoint);
|
||||
|
||||
addInstruction(ifFails);
|
||||
pushUnknown();
|
||||
addInstruction(gotoEnd);
|
||||
ifFails.setOffset(myCurrentFlow.getInstructionCount());
|
||||
addInstruction(new PushInstruction(myFactory.getConstFactory().getFalse(), null));
|
||||
gotoEnd.setOffset(myCurrentFlow.getInstructionCount());
|
||||
|
||||
} else { //assertTrue or assertFalse
|
||||
conditionalExit(exitPoint, type == ConditionChecker.Type.ASSERT_FALSE_METHOD);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,13 @@ public class IsNotNullCheck {
|
||||
if (Value.isNotNull(v)) {
|
||||
if(<warning descr="Condition 'v == null' is always 'false'">v == null</warning>) {}
|
||||
}
|
||||
}
|
||||
void bar2() {
|
||||
final Value v = call();
|
||||
System.out.println(v.hashCode());
|
||||
if (Value.isNotNull(v)) {
|
||||
|
||||
}
|
||||
}
|
||||
Value call() {return new Value();}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user