[java-inspections] IJ-CR-125834 EA-1063946 more filters for yield statements

- more tests

GitOrigin-RevId: 83b0ffbbeb982d269a8fc0333e6d7cf6799d1c1b
This commit is contained in:
Mikhail Pyltsin
2024-03-19 20:39:36 +00:00
committed by intellij-monorepo-bot
parent e4809f1b91
commit a6ea6ed644
2 changed files with 36 additions and 13 deletions
@@ -1,17 +1,23 @@
// "Replace with 'switch' expression" "false"
import java.util.*;
class Switch {
void test(Integer o) {
String s = "";
s<caret>witch (o) {
case 1:
s = "";
break;
default:
System.out.println("1");
s = o.toString(), o.toString();
break;
} ;
class NestedPatterns {
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);
}
}
}
}
}
@@ -0,0 +1,17 @@
// "Replace with 'switch' expression" "false"
import java.util.*;
class Switch {
void test(Integer o) {
String s = "";
s<caret>witch (o) {
case 1:
s = "";
break;
default:
System.out.println("1");
s = o.toString(), o.toString();
break;
} ;
}
}