rename conflict: local variable hided by a field in an inner class (IDEA-20700)

This commit is contained in:
anna
2010-01-29 17:07:21 +03:00
parent 79cf445952
commit d03c0ac2b2
6 changed files with 40 additions and 9 deletions
@@ -7,6 +7,7 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.rename.RenameProcessor;
import com.intellij.testFramework.LightCodeInsightTestCase;
import org.junit.Assert;
/**
* @author sashache
@@ -140,6 +141,17 @@ public class RenameCollisionsTest extends LightCodeInsightTestCase {
doTest("STATIC_FIELD");
}
public void testRenameLocalVariableHidesFieldInAnonymous() throws Exception {
try {
doTest("y");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
Assert.assertEquals("There is already a field <b><code>y</code></b>. It will conflict with the renamed variable", e.getMessage());
return;
}
fail("Conflicts were not found");
}
private void doTest(final String newName) throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".java");
PsiElement element = TargetElementUtilBase