mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: need to check if resolve is valid, otherwise there is no conflict (IJ-CR-138369)
GitOrigin-RevId: 2f895cdc66ded3ec8fb4c59843c1969e95f1c2d1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bf571336d4
commit
941612674c
+2
-2
@@ -396,8 +396,8 @@ public final class ConvertToInstanceMethodProcessor extends BaseRefactoringProce
|
||||
final PsiExpression qualifier = copy.getMethodExpression().getQualifierExpression();
|
||||
if (qualifier != null) {
|
||||
qualifier.delete();
|
||||
PsiMethod method = copy.resolveMethod();
|
||||
if (methodCall.resolveMethod() == method || method == null) {
|
||||
JavaResolveResult resolveResult = copy.resolveMethodGenerics();
|
||||
if (methodCall.resolveMethod() == resolveResult.getElement() || !resolveResult.isValidResult()) {
|
||||
return null;
|
||||
}
|
||||
return createQualifiedThisExpression();
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
int i;
|
||||
void run(int i) {}
|
||||
}
|
||||
class Other {
|
||||
static void <caret>run(Test test) {
|
||||
System.out.println(test.i);
|
||||
test.run(test.i);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
int i;
|
||||
|
||||
void run() {
|
||||
System.out.println(i);
|
||||
run(i);
|
||||
}
|
||||
|
||||
void run(int i) {}
|
||||
}
|
||||
class Other {
|
||||
}
|
||||
+1
@@ -13,6 +13,7 @@ public class ConvertToInstance8MethodTest extends ConvertToInstanceMethodTest {
|
||||
|
||||
public void testConflictingMembers() { doTest(0); }
|
||||
public void testNoConflictingMembers() { doTest(0); }
|
||||
public void testNoConflictingMembers2() { doTest(0); }
|
||||
|
||||
public void testThisInsteadOfNoQualifier() {
|
||||
doTest(0);
|
||||
|
||||
Reference in New Issue
Block a user