mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rename conflict: local variable hided by a field in an inner class (IDEA-20700)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user