From 4f943dcbf8c8239bdb23fbc06f6c6145854e458d Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Wed, 8 Jun 2016 22:01:31 +0300 Subject: [PATCH] KT-11778 Exception in Lombok plugin: Rewrite at slice FUNCTION #KT-11778 Fixed. EA-64051 Fixed. --- .../impl/JavaElementCollectionFromPsiArrayUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java index 70cf677a171..b0cdd1b75a5 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,7 +130,9 @@ public class JavaElementCollectionFromPsiArrayUtil { @NotNull private static List convert(@NotNull Iterable elements, @NotNull final Factory factory) { if (!elements.iterator().hasNext()) return Collections.emptyList(); - return CollectionsKt.map(elements, new Function1() { + + // 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() { @Override public Java invoke(Psi psi) { return factory.create(psi);