mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
introduce variable from one line lambda transforms body to code block (IDEA-91122)
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
Comparable<String> java = o -> {
|
||||
int c = o.length();
|
||||
return c;
|
||||
};
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
Comparable<String> java = o -> <selection>o.length()</selection>;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
Runnable java = () -> {
|
||||
String c = "";
|
||||
System.out.println(c);
|
||||
};
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
Runnable java = () -> System.out.println(<selection>""</selection>);
|
||||
}
|
||||
}
|
||||
@@ -371,6 +371,13 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.String>"));
|
||||
}
|
||||
|
||||
public void testOneLineLambdaVoidCompatible() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("c", false, false, false, "java.lang.String"));
|
||||
}
|
||||
public void testOneLineLambdaValueCompatible() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("c", false, false, false, "int"));
|
||||
}
|
||||
|
||||
private void doTest(IntroduceVariableBase testMe) throws Exception {
|
||||
@NonNls String baseName = "/refactoring/introduceVariable/" + getTestName(false);
|
||||
configureByFile(baseName + ".java");
|
||||
|
||||
Reference in New Issue
Block a user