Files
openide/java/java-tests/testData/inspection/switchExpressionMigration/beforeLabel.java
Roman Ivanov 4732cc18f6 [java] do not suggest to replace switch statement with label
IDEA-226169, IDEA-271705

GitOrigin-RevId: 194aa32a4d824970b8823b30c5f32a6c22b8f867
2021-06-22 17:11:09 +00:00

24 lines
629 B
Java

// "Replace with enhanced 'switch' statement" "false"
public class EnhancedSwitchIntentionBug {
public static void main(String... args) {
test("Say hello", "Exit", "Hello, bug!");
}
private static void test(String... commands) {
loopLabel:
for (String command : commands) {
switch<caret> (command) {
case "Say hello":
System.out.printf("Hello, %s!%n", System.getProperty("user.name"));
break;
case "Exit":
System.out.println("Goodbye.");
break loopLabel;
default:
System.out.println(command);
break;
}
}
}
}