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: da9cb8318212633c8ee6eae92f7c43f3f3167036
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9ca3db69b4
commit
855a23bf6e
@@ -0,0 +1,18 @@
|
||||
// "Replace with 'switch' expression" "true"
|
||||
|
||||
class NestedReturn {
|
||||
public static int parse(String value) {
|
||||
return switch (value) {
|
||||
case "string" -> 1;
|
||||
case "boolean" -> 1;
|
||||
default -> {
|
||||
String trimmed = value.trim();
|
||||
if (trimmed.endsWith("2113[]")) {
|
||||
byte ops = 1;
|
||||
yield ~ops;
|
||||
}
|
||||
throw new IllegalArgumentException(trimmed);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Replace with 'switch' expression" "false"
|
||||
import java.util.*;
|
||||
|
||||
class NestedPatterns {
|
||||
class NestedReturn {
|
||||
public static List<Class<?>> parse(String value) {
|
||||
switc<caret>h (value) {
|
||||
case "string":
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// "Replace with 'switch' expression" "true"
|
||||
|
||||
class NestedReturn {
|
||||
public static int parse(String value) {
|
||||
switc<caret>h (value) {
|
||||
case "string":
|
||||
return 1;
|
||||
case "boolean":
|
||||
return 1;
|
||||
default: {
|
||||
String trimmed = value.trim();
|
||||
if (trimmed.endsWith("2113[]")) {
|
||||
byte ops = 1;
|
||||
return ~ops;
|
||||
}
|
||||
throw new IllegalArgumentException(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user