Files
Mikhail Pyltsinandintellij-monorepo-bot 855a23bf6e [java-inspections] IJ-CR-125834 EA-1063946 more filters for yield statements
- more tests

GitOrigin-RevId: da9cb8318212633c8ee6eae92f7c43f3f3167036
2024-03-20 11:14:13 +00:00

23 lines
659 B
Java

// "Replace with 'switch' expression" "false"
import java.util.*;
class NestedReturn {
public static List<Class<?>> parse(String value) {
switc<caret>h (value) {
case "string":
return List.of(String.class);
case "boolean":
return List.of(Boolean.class);
default: {
String trimmed = value.trim();
if (trimmed.endsWith("2113[]")) {
List<Class<?>> children = new ArrayList<>();
children.add(List.class);
children.addAll(parse(trimmed.substring(0, trimmed.length() - 2)));
return {};
}
throw new IllegalArgumentException(trimmed);
}
}
}
}