method refs: rename in case of constructor refs fixed

This commit is contained in:
anna
2012-12-18 13:07:30 +01:00
parent b706a40b73
commit 55ce55a20e
4 changed files with 39 additions and 1 deletions
@@ -115,7 +115,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
final IElementType elType = child.getElementType();
if (elType == JavaTokenType.DOUBLE_COLON) {
return ChildRole.DOUBLE_COLON;
} else if (elType == JavaTokenType.IDENTIFIER) {
} else if (elType == JavaTokenType.IDENTIFIER || elType == JavaElementType.REFERENCE_EXPRESSION) {
return ChildRole.REFERENCE_NAME;
}
return ChildRole.EXPRESSION;
@@ -0,0 +1,17 @@
public class FooBar {
private static final class B<caret>ar {
private Bar() {
}
}
private interface I<T> {
T create();
}
static void foo(I intf) {}
public static void main(String[] args) throws Exception {
foo(Bar::new);
}
}
@@ -0,0 +1,17 @@
public class FooBar {
private static final class Bar1 {
private Bar1() {
}
}
private interface I<T> {
T create();
}
static void foo(I intf) {}
public static void main(String[] args) throws Exception {
foo(Bar1::new);
}
}
@@ -54,6 +54,10 @@ public class RenameLocalTest extends LightRefactoringTestCase {
doTest("_i");
}
public void testClassNameUsedInMethodRefs() throws Exception {
doTest("Bar1");
}
public void testRenameParamUniqueName() throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".java");
PsiElement element = TargetElementUtilBase