Minor, move the Lombok hack a bit higher
This commit is contained in:
+4
-2
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.load.java.structure.impl;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import kotlin.collections.ArraysKt;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -96,13 +97,14 @@ public class JavaClassImpl extends JavaClassifierImpl<PsiClass> implements JavaC
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<JavaMethod> getMethods() {
|
||||
return methods(ArraysKt.filter(getPsi().getMethods(), new Function1<PsiMethod, Boolean>() {
|
||||
// We apply distinct here because PsiClass#getMethods() can return duplicate PSI methods, for example in Lombok (see KT-11778)
|
||||
return CollectionsKt.distinct(methods(ArraysKt.filter(getPsi().getMethods(), new Function1<PsiMethod, Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke(PsiMethod method) {
|
||||
// Return type seems to be null for example for the 'clone' Groovy method generated by @AutoClone (see EA-73795)
|
||||
return !method.isConstructor() && method.getReturnType() != null;
|
||||
}
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -131,8 +131,7 @@ public class JavaElementCollectionFromPsiArrayUtil {
|
||||
private static <Psi, Java> List<Java> convert(@NotNull Iterable<Psi> elements, @NotNull final Factory<Psi, Java> factory) {
|
||||
if (!elements.iterator().hasNext()) return Collections.emptyList();
|
||||
|
||||
// we apply distinct here, because sometimes PsiClass#getMethods() and others can give us duplicate psi methods. see KT-11778.
|
||||
return CollectionsKt.map(CollectionsKt.distinct(elements), new Function1<Psi, Java>() {
|
||||
return CollectionsKt.map(elements, new Function1<Psi, Java>() {
|
||||
@Override
|
||||
public Java invoke(Psi psi) {
|
||||
return factory.create(psi);
|
||||
|
||||
Reference in New Issue
Block a user