Files
openide/java/java-tests/testData/refactoring/extractMethod/NullableCheckBreakDuplicate_after.java
Mikhail Pyltsin 36f87ac0b6 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- fix tests
- fixes to show external annotations

GitOrigin-RevId: 79cde38663de10c2985b72e76e98372fef214b20
2024-06-26 20:34:48 +00:00

39 lines
740 B
Java

import org.jetbrains.annotations.Nullable;
import java.util.List;
public class NullableCheckBreakDuplicate {
List<Pojo> things;
void foo() {
while (true) {
Pojo x = newMethod();
if (x == null) break;
System.out.println(x.it);
}
}
@Nullable
private NullableCheckBreakDuplicate.Pojo newMethod() {
Pojo x = things.get(0);
if (x.it > 0) return null;
things.remove(x);
return x;
}
void baz() {
while (true) {
Pojo x = newMethod();
if (x == null) break;
System.out.println(x.it);
}
}
static class Pojo {
double it;
Pojo(double w) { it = w; }
}
}