Remove JavaClass.getAllMethods()/getAllFields()
Their behavior is different in PSI and reflection (two things that this interface is supposed to unify), so there's no point in making it interface methods, rather we should just walk supertype hierarchy manually Also make JavaClassImpl.getSupertypes() invoke PsiClass.getSuperTypes(), because it also contains java.lang.Object for interfaces, which makes equals/hashCode/toString appear in interfaces' getAllMethods() as well
This commit is contained in:
+1
-23
@@ -18,7 +18,6 @@ package org.jetbrains.jet.lang.resolve.java.structure.impl;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiSubstitutorImpl;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import kotlin.Function1;
|
||||
import kotlin.KotlinPackage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -90,14 +89,10 @@ public class JavaClassImpl extends JavaClassifierImpl<PsiClass> implements JavaC
|
||||
return typeParameters(getPsi().getTypeParameters());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<JavaClassifierType> getSupertypes() {
|
||||
// TODO: getPsi().getSuperTypes() ?
|
||||
Collection<JavaClassifierType> superClasses = classifierTypes(getPsi().getExtendsListTypes());
|
||||
Collection<JavaClassifierType> superInterfaces = classifierTypes(getPsi().getImplementsListTypes());
|
||||
return ContainerUtil.collect(ContainerUtil.concat(superClasses, superInterfaces).iterator());
|
||||
return classifierTypes(getPsi().getSuperTypes());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,29 +106,12 @@ public class JavaClassImpl extends JavaClassifierImpl<PsiClass> implements JavaC
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<JavaMethod> getAllMethods() {
|
||||
return methods(KotlinPackage.filter(getPsi().getAllMethods(), new Function1<PsiMethod, Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke(PsiMethod method) {
|
||||
return !method.isConstructor();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<JavaField> getFields() {
|
||||
return fields(getPsi().getFields());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<JavaField> getAllFields() {
|
||||
return fields(getPsi().getAllFields());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<JavaConstructor> getConstructors() {
|
||||
|
||||
Reference in New Issue
Block a user