mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-15 20:26:04 +07:00
Java: Update variable nullability only when DFA is completed successfully (IDEA-188416)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class TooComplexCode {
|
||||
static class X { @NotNull X get() { return this; }}
|
||||
static class A extends X { @NotNull X get() { return new B(); }}
|
||||
static class B extends X { @NotNull X get() { return new C(); }}
|
||||
static class C extends X { @NotNull X get() { return new A(); }}
|
||||
|
||||
void tooComplex(@NotNull X x) {
|
||||
if (x instanceof A) {
|
||||
<selection>X y = x.get();</selection>
|
||||
if (y instanceof A) {
|
||||
System.out.println("A A "+x+' '+y);
|
||||
}
|
||||
if (y instanceof B) {
|
||||
System.out.println("A B "+x+' '+y);
|
||||
}
|
||||
}
|
||||
if (x instanceof B) {
|
||||
X y = x.get();
|
||||
if (y instanceof A) {
|
||||
System.out.println("B A "+x+' '+y);
|
||||
}
|
||||
if (y instanceof B) {
|
||||
System.out.println("B B "+x+' '+y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user