mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
build constructor dfa to check final field not-nullability (IDEA-114828)
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
import java.lang.IllegalArgumentException;
|
||||
import java.lang.Object;
|
||||
|
||||
public class Doo {
|
||||
private final Object myA;
|
||||
private final Object myB;
|
||||
private final Object myC;
|
||||
|
||||
public Doo(Object myA, Object myB, Object c) {
|
||||
if (myB == null) {
|
||||
// assert myA != null;
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
assert c != null;
|
||||
this.myA = myA;
|
||||
this.myB = myB;
|
||||
myC = c;
|
||||
}
|
||||
|
||||
int bar() {
|
||||
return myC.hashCode();
|
||||
}
|
||||
|
||||
|
||||
int foo() {
|
||||
if (<warning descr="Condition 'myB == null' is always 'false'">myB == null</warning>) {
|
||||
return 2;
|
||||
}
|
||||
if (<warning descr="Condition 'myC != null' is always 'true'">myC != null</warning>) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return myA.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testNotNullPrimitive() throws Throwable { doTest(); }
|
||||
public void testBoxing128() throws Throwable { doTest(); }
|
||||
public void testFinalFieldsInitializedByAnnotatedParameters() throws Throwable { doTest(); }
|
||||
public void testFinalFieldsInitializedNotNull() throws Throwable { doTest(); }
|
||||
public void testMultiCatch() throws Throwable { doTest(); }
|
||||
public void testContinueFlushesLoopVariable() throws Throwable { doTest(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user