mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
introduce variable from lambda expression
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
interface SAM<X> {
|
||||
X m(int i, int j);
|
||||
}
|
||||
|
||||
class Foo {
|
||||
void test() {
|
||||
SAM<Integer> c = (i, j)->i + j;
|
||||
m(c);
|
||||
}
|
||||
void m(SAM<Integer> s) { }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
interface SAM<X> {
|
||||
X m(int i, int j);
|
||||
}
|
||||
|
||||
class Foo {
|
||||
void test() {
|
||||
m(<selection>(i, j) -> i + j</selection>);
|
||||
}
|
||||
void m(SAM<Integer> s) { }
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
interface SAM<X> {
|
||||
X m(int i, int j);
|
||||
}
|
||||
|
||||
class Foo {
|
||||
void test() {
|
||||
SAM<Integer> c = (i, j)->"" + i + j;
|
||||
SAM<Integer> s3 = m(c);
|
||||
}
|
||||
<X> SAM<X> m(SAM<X> s) { return null; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
interface SAM<X> {
|
||||
X m(int i, int j);
|
||||
}
|
||||
|
||||
class Foo {
|
||||
void test() {
|
||||
SAM<Integer> s3 = m(<selection>(i, j) -> "" + i + j</selection>);
|
||||
}
|
||||
<X> SAM<X> m(SAM<X> s) { return null; }
|
||||
}
|
||||
@@ -335,6 +335,14 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
doTest(new MockIntroduceVariableHandler("c", false, false, false, CommonClassNames.JAVA_LANG_OBJECT));
|
||||
}
|
||||
|
||||
public void testLambdaExpr() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.Integer>"));
|
||||
}
|
||||
|
||||
public void testLambdaExprNotAccepted() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.Integer>"));
|
||||
}
|
||||
|
||||
private void doTest(IntroduceVariableBase testMe) throws Exception {
|
||||
@NonNls String baseName = "/refactoring/introduceVariable/" + getTestName(false);
|
||||
configureByFile(baseName + ".java");
|
||||
|
||||
Reference in New Issue
Block a user