variable incomplete code searcher should not find methods with the same name even if they are also unresolved; inline covered by RefactoringUtil.renameVariableReferences() (IDEA-126312)

This commit is contained in:
Anna Kozlova
2014-06-18 17:17:13 +02:00
parent aecfed29e7
commit f0f8dd1db2
4 changed files with 27 additions and 0 deletions
@@ -54,6 +54,7 @@ public class VariableInIncompleteCodeSearcher extends QueryExecutorBase<PsiRefer
if (element instanceof PsiJavaCodeReferenceElement) {
final PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)element;
if (!ref.isQualified() && name.equals(ref.getText()) &&
!(ref.getParent() instanceof PsiMethodCallExpression) &&
ref.resolve() == null && ref.advancedResolve(true).getElement() == refElement) {
consumer.process(ref);
}
@@ -0,0 +1,13 @@
class Test {
public boolean isConsideredFinal(int cl) {
return haveSeenAllExp<caret>ectedAtCl(cl);
}
private boolean haveSeenAllExpectedAtCl(int cl) {
return cl == cl();
}
int cl() {
return 0;
}
}
@@ -0,0 +1,9 @@
class Test {
public boolean isConsideredFinal(int cl) {
return cl == cl();
}
int cl() {
return 0;
}
}
@@ -264,6 +264,10 @@ public class InlineMethodTest extends LightRefactoringTestCase {
doTest();
}
public void testSameVarMethodNames() throws Exception {
doTest();
}
private void doTestInlineThisOnly() {
@NonNls String fileName = "/refactoring/inlineMethod/" + getTestName(false) + ".java";
configureByFile(fileName);