mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
IDEA-CR-32099
This commit is contained in:
@@ -1184,22 +1184,7 @@ public class ExpectedTypesProvider {
|
||||
}
|
||||
final PsiManager manager = methodCallExpr.getManager();
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
|
||||
final PsiMethod[] methods = myClassProvider.findDeclaredMethods(manager, reference.getReferenceName());
|
||||
LinkedHashSet<PsiMethod> psiMethods = new LinkedHashSet<>();
|
||||
for (PsiMethod m : methods) {
|
||||
if (m.hasModifierProperty(PsiModifier.STATIC) || m.hasModifierProperty(PsiModifier.PRIVATE)) {
|
||||
psiMethods.add(m);
|
||||
}
|
||||
else {
|
||||
PsiMethod[] superMethods = m.findDeepestSuperMethods();
|
||||
if (superMethods.length > 0) {
|
||||
psiMethods.addAll(Arrays.asList(superMethods));
|
||||
}
|
||||
else {
|
||||
psiMethods.add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<PsiMethod> psiMethods = mapToDeepestSuperMethods(myClassProvider.findDeclaredMethods(manager, reference.getReferenceName()));
|
||||
Set<ExpectedTypeInfo> types = new THashSet<>();
|
||||
for (PsiMethod method : psiMethods) {
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
@@ -1220,6 +1205,25 @@ public class ExpectedTypesProvider {
|
||||
return types.toArray(ExpectedTypeInfo.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
private static Set<PsiMethod> mapToDeepestSuperMethods(PsiMethod[] methods) {
|
||||
LinkedHashSet<PsiMethod> psiMethods = new LinkedHashSet<>();
|
||||
for (PsiMethod m : methods) {
|
||||
if (m.hasModifierProperty(PsiModifier.STATIC) || m.hasModifierProperty(PsiModifier.PRIVATE)) {
|
||||
psiMethods.add(m);
|
||||
}
|
||||
else {
|
||||
PsiMethod[] superMethods = m.findDeepestSuperMethods();
|
||||
if (superMethods.length > 0) {
|
||||
psiMethods.addAll(Arrays.asList(superMethods));
|
||||
}
|
||||
else {
|
||||
psiMethods.add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
return psiMethods;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ExpectedTypeInfo[] findClassesWithDeclaredField(@NotNull PsiReferenceExpression expression) {
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(expression.getProject());
|
||||
|
||||
+1
-1
@@ -282,7 +282,7 @@ public class InvalidClass {
|
||||
'''
|
||||
}
|
||||
|
||||
void 'test expected types'() {
|
||||
void 'test deepest super methods are included in expected info when available'() {
|
||||
configureFromFileText 'a.java', '''\
|
||||
class A {
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user