inplace rename: do not rename enum constants when constructor was renamed (IDEA-91063)

This commit is contained in:
Anna Kozlova
2012-09-10 21:43:51 +04:00
parent 1df916372a
commit 5315375de4
4 changed files with 24 additions and 0 deletions
@@ -0,0 +1,8 @@
enum Foo {
BAR,
BAZ
;
Fo<caret>o() {
}
}
@@ -0,0 +1,8 @@
enum Bar {
BAR,
BAZ
;
Bar() {
}
}
@@ -61,6 +61,10 @@ public class RenameMembersInplaceTest extends LightCodeInsightTestCase {
public void testMethodWithJavadocRef() throws Exception {
doTestInplaceRename("bar");
}
public void testEnumConstructor() throws Exception {
doTestInplaceRename("Bar");
}
public void testConflictingMethodName() throws Exception {
try {
@@ -220,6 +220,10 @@ public abstract class InplaceRefactoring {
}
protected boolean acceptReference(PsiReference reference) {
final PsiElement element = reference.getElement();
if (element instanceof PsiNamedElement) {
return Comparing.strEqual(((PsiNamedElement)element).getName(), myElementToRename.getName());
}
return true;
}