Files
openide/java/java-tests/testData/refactoring/extractMethodNew/NotNullArgumentTooComplexCode_after.java
Mikhail Pyltsin 330ba98e01 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- fix NullableManager, when it can't find annotation in type

GitOrigin-RevId: 121927429534971abb4a50d1f670afbed9384045
2024-06-26 20:34:48 +00:00

34 lines
1001 B
Java

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) {
X y = newMethod(x);
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 = newMethod(x);
if (y instanceof A) {
System.out.println("B A "+x+' '+y);
}
if (y instanceof B) {
System.out.println("B B "+x+' '+y);
}
}
}
@NotNull
private X newMethod(@NotNull X x) {
return x.get();
}
}