create method from usage: do not qualify already qualified ref (IDEA-91041)

This commit is contained in:
Anna Kozlova
2012-09-11 17:31:14 +04:00
parent 6ec981fb45
commit 1bdca6d4e5
3 changed files with 37 additions and 1 deletions

View File

@@ -167,7 +167,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
}
if (enclosingContext instanceof PsiMethod && methodName.equals(enclosingContext.getName()) &&
PsiTreeUtil.isAncestor(targetClass, parentClass, true)) {
PsiTreeUtil.isAncestor(targetClass, parentClass, true) && !ref.isQualified()) {
FieldConflictsResolver.qualifyReference(ref, method, null);
}

View File

@@ -0,0 +1,20 @@
// "Create Method 'run'" "true"
class Bug {
interface Foo<X> {
void run(X x);
}
public static void main(String[] args) {
new Foo<Bug>() {
@Override
public void run(Bug o) {
o.run();
}
};
}
private void run() {
<selection>//To change body of created methods use File | Settings | File Templates.</selection>
}
}

View File

@@ -0,0 +1,16 @@
// "Create Method 'run'" "true"
class Bug {
interface Foo<X> {
void run(X x);
}
public static void main(String[] args) {
new Foo<Bug>() {
@Override
public void run(Bug o) {
o.ru<caret>n();
}
};
}
}