mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
inline to anonymous: convert to lambda when applicable (IDEA-173821)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
public class <caret>MyComparator implements Comparator<String> {
|
||||
@Override
|
||||
public int compare(String s1, String s2) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sort(List<String> scores) {
|
||||
scores.sort(new MyComparator());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
void sort(List<String> scores) {
|
||||
scores.sort((s1, s2) -> 0);
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,10 @@ public class InlineToAnonymousClassTest extends LightRefactoringTestCase {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testConvertToLambdaJava8() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testClassInitializer() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
@@ -499,6 +503,9 @@ public class InlineToAnonymousClassTest extends LightRefactoringTestCase {
|
||||
|
||||
@Override
|
||||
protected LanguageLevel getLanguageLevel() {
|
||||
if (getTestName(false).endsWith("Java8")) {
|
||||
return LanguageLevel.JDK_1_8;
|
||||
}
|
||||
return LanguageLevel.JDK_1_7;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user