mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
when a nullable parameter is reassigned with an unknown value, don't still consider it nullable (IDEA-54770)
This commit is contained in:
@@ -277,6 +277,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
applyCondition(compareToNull(var, true));
|
||||
}
|
||||
else if (value instanceof DfaTypeValue) {
|
||||
getVariableState(var).setNullable(((DfaTypeValue)value).isNullable());
|
||||
DfaRelationValue dfaInstanceof = myFactory.getRelationFactory().createRelation(var, value, JavaTokenType.INSTANCEOF_KEYWORD, false);
|
||||
applyInstanceofOrNull(dfaInstanceof);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BrokenAlignment {
|
||||
|
||||
String unknown(String s) { return s; }
|
||||
|
||||
public void example(@Nullable String value) {
|
||||
value = unknown(<warning descr="Argument 'value' might be null but passed to non annotated parameter">value</warning>);
|
||||
if (value.contains("%")) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,4 +83,6 @@ public class DataFlowInspectionFixtureTest extends JavaCodeInsightFixtureTestCas
|
||||
public void testFinalFieldsDifferentInstances() throws Throwable { doTest(); }
|
||||
public void testChainedFinalFieldAccessorsDfa() throws Throwable { doTest(); }
|
||||
|
||||
public void testAssigningUnknownToNullable() throws Throwable { doTest(); }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user