mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-104754 Good code yellow: Unboxing
This commit is contained in:
+3
@@ -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(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user