mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-122014 Extract method duplicates analysis fails in case of inner classes
This commit is contained in:
+11
@@ -354,6 +354,17 @@ public class DuplicatesFinder {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (qualifier1 == null && qualifier2 == null) {
|
||||
final PsiClass patternClass = RefactoringChangeUtil.getThisClass(pattern);
|
||||
final PsiClass candidateClass = RefactoringChangeUtil.getThisClass(candidate);
|
||||
if (resolveResult1 == resolveResult2 &&
|
||||
resolveResult1 instanceof PsiMember &&
|
||||
!InheritanceUtil.isInheritorOrSelf(candidateClass, patternClass, true) &&
|
||||
InheritanceUtil.isInheritorOrSelf(candidateClass, ((PsiMember)resolveResult1).getContainingClass(), true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (pattern instanceof PsiTypeCastExpression) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
class CommonParent {
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
public class A extends CommonParent {
|
||||
|
||||
private void <caret>f() {
|
||||
foo();
|
||||
}
|
||||
|
||||
private class B extends CommonParent {
|
||||
void g() {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,10 @@ public class FindMethodDuplicatesTest extends FindMethodDuplicatesBaseTest{
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSkipNonRelatedCalls() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testMappingAny2ParameterPrimitiveLvalue() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user