From 490970e65e4780eb801df58e55a20f58d5d66d28 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 10 Jan 2023 13:39:46 +0100 Subject: [PATCH] Adjust KotlinJavaPsiFacade::knownClassNamesInPackage for empty scope The method must return an empty set in that case, instead of null that would mean we can't compute it. The problem was found when running FirLoadCompiledKotlinGenerated --- .../kotlin/resolve/jvm/KotlinJavaPsiFacade.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java index 02292daf7d5..f55f8385300 100644 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java +++ b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java @@ -52,10 +52,7 @@ import org.jetbrains.kotlin.name.ClassId; import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -214,9 +211,12 @@ public class KotlinJavaPsiFacade implements Disposable { return javaClass; } + /** + * @return null in case the set of names is impossible to compute correctly + */ @Nullable public Set knownClassNamesInPackage(@NotNull FqName packageFqName, @NotNull GlobalSearchScope scope) { - if (scope == GlobalSearchScope.EMPTY_SCOPE) return null; + if (scope == GlobalSearchScope.EMPTY_SCOPE) return Collections.emptySet(); KotlinPsiElementFinderWrapper[] finders = finders();