mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] IJ-CR-125834 EA-1063946 more filters for yield statements
- more tests GitOrigin-RevId: 83b0ffbbeb982d269a8fc0333e6d7cf6799d1c1b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e4809f1b91
commit
a6ea6ed644
+19
-13
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -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;
|
||||
} ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user