[java-highlighting] IDEA-315469 Quickfixes for switch labels with 'default'

- fix to reverse 'case default, null'
- fix to replace 'case default' with 'default'

GitOrigin-RevId: 3762a40c859bb7a13a638614b3200b0005d8e85a
This commit is contained in:
Mikhail Pyltsin
2023-10-31 17:31:21 +01:00
committed by intellij-monorepo-bot
parent 17affe2b0d
commit 3d7a18e986
21 changed files with 355 additions and 17 deletions

View File

@@ -0,0 +1,12 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
Object o = null;
switch (o) {
case String s:
System.out.println("2");
/*some text*/
default:
System.out.println("3") /*some text2*/;
}
}

View File

@@ -0,0 +1,11 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
Object o = null;
switch (o) {
/*some text*/
default -> {
System.out.println("1") /*some text2*/;
}
} }
}

View File

@@ -0,0 +1,11 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
Object o = null;
switch (o) {
case String s:
System.out.println("2");
case /*some text*/ def<caret>ault:
System.out.println("3") /*some text2*/;
}
}

View File

@@ -0,0 +1,10 @@
// "Replace 'case default' with 'default'" "true-preview"
class Test {
void f() {
Object o = null;
switch (o) {
case /*some text*/ defau<caret>lt -> {
System.out.println("1") /*some text2*/;
}
} }
}