mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
RemoveUnusedVariableUtil: code generation fixes
1. Support Java 12 switch rules and switch expressions (IDEA-203692) 2. Support void expression lambdas 3. Fix PSI structure when expression list statement is reduced to single expression
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove variable 'i'" "true"
|
||||
public class Main {
|
||||
void test(String s) {
|
||||
foo(1);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Remove field 'x'" "true"
|
||||
public class Main {
|
||||
|
||||
void test() {
|
||||
Runnable r = () -> {
|
||||
};
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Remove variable 'i'" "true"
|
||||
public class Main {
|
||||
int test(String s) {
|
||||
return switch(s) {
|
||||
default -> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Remove variable 'i'" "true"
|
||||
public class Main {
|
||||
void test(String s) {
|
||||
switch(s) {
|
||||
case "foo" -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Remove variable 'i'" "true"
|
||||
public class Main {
|
||||
void test(String s) {
|
||||
int <caret>i;
|
||||
foo(i = 1);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Remove field 'x'" "true"
|
||||
public class Main {
|
||||
private int <caret>x;
|
||||
|
||||
void test() {
|
||||
Runnable r = () -> x = 1;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Remove variable 'i'" "true"
|
||||
public class Main {
|
||||
int test(String s) {
|
||||
int <caret>i;
|
||||
return switch(s) {
|
||||
default -> i = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Remove variable 'i'" "true"
|
||||
public class Main {
|
||||
void test(String s) {
|
||||
int <caret>i;
|
||||
switch(s) {
|
||||
case "foo" -> i = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user