method ref -> lambda: on arrays: resolve naming conflicts

(cherry picked from commit 91a8d6b875756fa2ca8a97afa9bf0cf7dec1a02c)
This commit is contained in:
anna
2013-03-21 10:40:43 +01:00
parent a1753089fe
commit 5651726786
4 changed files with 33 additions and 1 deletions
@@ -122,7 +122,7 @@ public class ReplaceMethodRefWithLambdaIntention extends Intention {
int dim = type.getArrayDimensions();
buf.append(type.getDeepComponentType().getCanonicalText());
buf.append("[");
buf.append(parameters[0].getName());
buf.append(map.get(parameters[0]));
buf.append("]");
while (--dim > 0) {
buf.append("[]");
@@ -0,0 +1,14 @@
public class Foo {
public void test() {
Object i = null;
long[][] avg = collect(long[][]:<caret>:new);
}
interface P<T> {
T _(int i);
}
<T> T collect(P<T> h) {
return null;
}
}
@@ -0,0 +1,14 @@
public class Foo {
public void test() {
Object i = null;
long[][] avg = collect((i1) -> new long[i1][]);
}
interface P<T> {
T _(int i);
}
<T> T collect(P<T> h) {
return null;
}
}
@@ -101,4 +101,8 @@ public class ReplaceMethodReferenceWithLambdaIntentionTest extends IPPTestCase {
public void testArrayMethodRef() throws Exception {
doTest();
}
public void testArrayConstructorRefUniqueParamName() throws Exception {
doTest();
}
}