Files
openide/java/java-tests/testData/refactoring/extractMethodAndDuplicatesInplace/ConditionalYield_after.java
Alexandr Suhinin b41164371c [java extract method] make method static by default
GitOrigin-RevId: 3cac9f65131e216cc2dd43fe58bf0cccbcb69839
2022-04-26 04:59:44 +00:00

24 lines
507 B
Java

import org.jetbrains.annotations.Nullable;
public class Test {
String test(String s){
return switch (s) {
case "a" -> {
String one = getString();
if (one != null) yield one;
yield "default";
}
default -> "two";
};
}
@Nullable
private static String getString() {
if (new Random().nextBoolean()) {
System.out.println();
return "one";
}
return null;
}
}