mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: handle in a special way only getX() != null comparisons (IDEA-141823)
This commit is contained in:
+4
-2
@@ -650,13 +650,15 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
return true;
|
||||
}
|
||||
|
||||
final boolean containsCalls = dfaLeft instanceof DfaVariableValue && ((DfaVariableValue)dfaLeft).containsCalls();
|
||||
|
||||
// track "x" property state only inside "if (getX() != null) ..."
|
||||
if (dfaLeft instanceof DfaVariableValue && ((DfaVariableValue)dfaLeft).containsCalls() && (!isNull(dfaRight) || !isNegated)) {
|
||||
if (containsCalls && !isNotNull(dfaLeft) && isNull(dfaRight) && !isNegated) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dfaLeft == dfaRight) {
|
||||
return !isNegated;
|
||||
return containsCalls || !isNegated;
|
||||
}
|
||||
|
||||
if (isNull(dfaLeft) && isNotNull(dfaRight) || isNull(dfaRight) && isNotNull(dfaLeft)) {
|
||||
|
||||
@@ -41,3 +41,21 @@ class Foo {
|
||||
|
||||
}
|
||||
|
||||
class Test {
|
||||
@NotNull
|
||||
String getName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract("!null -> !null")
|
||||
String convert(@Nullable String name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
String test() {
|
||||
return convert(getName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user