mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
multi-module setup: method hierarchy should traverse supers according to the place build (IDEA-90914)
This commit is contained in:
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.HierarchicalMethodSignatureImpl;
|
||||
import com.intellij.psi.impl.source.PsiClassImpl;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.searches.DeepestSuperMethodsSearch;
|
||||
import com.intellij.psi.search.searches.SuperMethodsSearch;
|
||||
import com.intellij.psi.util.*;
|
||||
@@ -45,7 +46,7 @@ public class PsiSuperMethodImplUtil {
|
||||
@NotNull
|
||||
@Override
|
||||
public Map<MethodSignature, HierarchicalMethodSignature> fun(PsiClass dom) {
|
||||
return buildMethodHierarchy(dom, null, PsiSubstitutor.EMPTY, true, new THashSet<PsiClass>(), false);
|
||||
return buildMethodHierarchy(dom, null, PsiSubstitutor.EMPTY, true, new THashSet<PsiClass>(), false, dom.getResolveScope());
|
||||
}
|
||||
});
|
||||
private static final PsiCacheKey<FactoryMap<String, Map<MethodSignature, HierarchicalMethodSignature>>, PsiClass> SIGNATURES_BY_NAME_KEY = PsiCacheKey
|
||||
@@ -56,7 +57,7 @@ public class PsiSuperMethodImplUtil {
|
||||
@Nullable
|
||||
@Override
|
||||
protected Map<MethodSignature, HierarchicalMethodSignature> create(String methodName) {
|
||||
return buildMethodHierarchy(psiClass, methodName, PsiSubstitutor.EMPTY, true, new THashSet<PsiClass>(), false);
|
||||
return buildMethodHierarchy(psiClass, methodName, PsiSubstitutor.EMPTY, true, new THashSet<PsiClass>(), false, psiClass.getResolveScope());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -131,7 +132,8 @@ public class PsiSuperMethodImplUtil {
|
||||
@NotNull PsiSubstitutor substitutor,
|
||||
final boolean includePrivates,
|
||||
@NotNull final Set<PsiClass> visited,
|
||||
boolean isInRawContext) {
|
||||
boolean isInRawContext,
|
||||
GlobalSearchScope resolveScope) {
|
||||
ProgressManager.checkCanceled();
|
||||
Map<MethodSignature, HierarchicalMethodSignature> result = new LinkedHashMap<MethodSignature, HierarchicalMethodSignature>();
|
||||
final Map<MethodSignature, List<PsiMethod>> sameParameterErasureMethods = new THashMap<MethodSignature, List<PsiMethod>>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY);
|
||||
@@ -189,6 +191,8 @@ public class PsiSuperMethodImplUtil {
|
||||
}
|
||||
|
||||
for (PsiClassType superType : aClass.getSuperTypes()) {
|
||||
superType = PsiClassImplUtil.correctType(superType, resolveScope);
|
||||
if (superType == null) continue; //super class doesn't belong to resolve scope
|
||||
PsiClassType.ClassResolveResult superTypeResolveResult = superType.resolveGenerics();
|
||||
PsiClass superClass = superTypeResolveResult.getElement();
|
||||
if (superClass == null) continue;
|
||||
@@ -197,7 +201,7 @@ public class PsiSuperMethodImplUtil {
|
||||
PsiSubstitutor finalSubstitutor = obtainFinalSubstitutor(superClass, superSubstitutor, substitutor, isInRawContext);
|
||||
|
||||
final boolean isInRawContextSuper = (isInRawContext || PsiUtil.isRawSubstitutor(superClass, superSubstitutor)) && superClass.getTypeParameters().length != 0;
|
||||
Map<MethodSignature, HierarchicalMethodSignature> superResult = buildMethodHierarchy(superClass, nameHint, finalSubstitutor, false, visited, isInRawContextSuper);
|
||||
Map<MethodSignature, HierarchicalMethodSignature> superResult = buildMethodHierarchy(superClass, nameHint, finalSubstitutor, false, visited, isInRawContextSuper, resolveScope);
|
||||
visited.remove(superClass);
|
||||
|
||||
List<Pair<MethodSignature, HierarchicalMethodSignature>> flattened = new ArrayList<Pair<MethodSignature, HierarchicalMethodSignature>>();
|
||||
|
||||
Reference in New Issue
Block a user