IDEA-104754 Good code yellow: Unboxing

This commit is contained in:
peter
2013-07-31 17:49:44 +02:00
parent 9795fd2dc7
commit 9329331182
3 changed files with 18 additions and 0 deletions
@@ -292,6 +292,9 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
if (value instanceof DfaVariableValue) {
myVariableStates.put(var, getVariableState((DfaVariableValue)value).clone());
}
else if (value instanceof DfaBoxedValue) {
getVariableState(var).setNullable(false);
}
}
if (getVariableState(var).isNotNull()) {
@@ -0,0 +1,14 @@
import org.jetbrains.annotations.Nullable;
class Baz {
Integer bar() { return 2; }
void g() {
@Nullable Integer foo = bar();
if (foo == null) {
foo = 0;
}
System.out.println(foo.intValue());
}
}
@@ -278,4 +278,5 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
}
public void testContractAnnotation() { doTest(); }
public void testBoxingImpliesNotNull() { doTest(); }
}