mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
fix dfa when a notnull parameter is assigned to null
This commit is contained in:
+7
-2
@@ -268,9 +268,8 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
return;
|
||||
}
|
||||
|
||||
setVariableState(var, getVariableState(var).withValue(value));
|
||||
setVariableState(var, withValueNullability(value, getVariableState(var).withValue(value)));
|
||||
if (value instanceof DfaTypeValue) {
|
||||
setVariableState(var, getVariableState(var).withNullability(((DfaTypeValue)value).getNullness()));
|
||||
DfaRelationValue dfaInstanceof = myFactory.getRelationFactory().createRelation(var, value, JavaTokenType.INSTANCEOF_KEYWORD, false);
|
||||
if (((DfaTypeValue)value).isNotNull()) {
|
||||
applyCondition(dfaInstanceof);
|
||||
@@ -293,6 +292,12 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
}
|
||||
}
|
||||
|
||||
private DfaVariableState withValueNullability(DfaValue value, DfaVariableState state) {
|
||||
if (value instanceof DfaTypeValue) return state.withNullability(((DfaTypeValue)value).getNullness());
|
||||
if (isNull(value)) return state.withNullability(Nullness.NULLABLE);
|
||||
return state;
|
||||
}
|
||||
|
||||
private DfaValue handleFlush(DfaVariableValue flushed, DfaValue value) {
|
||||
if (value instanceof DfaVariableValue && (value == flushed || myFactory.getVarFactory().getAllQualifiedBy(flushed).contains(value))) {
|
||||
Nullness nullability = isNotNull(value) ? Nullness.NOT_NULL : ((DfaVariableValue)value).getInherentNullability();
|
||||
|
||||
Reference in New Issue
Block a user