From c20bdd3c30261ed48e299a370191b2496e054b93 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Mon, 14 Oct 2019 15:49:45 +0200 Subject: [PATCH] Clean up after reusing allDescriptors() from LazyJavaScope to avoid compute contributed descriptors in LazyJavaPackageScope --- .../java/lazy/descriptors/LazyJavaPackageScope.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt index f2580c23531..5d47f23d7dd 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt @@ -174,11 +174,11 @@ class LazyJavaPackageScope( // combined computeDescriptors() and computeClassNames() // computeFunctionNames and computePropertyNames return always emptySet // therefore don't need to check if kindFilter anything else but CLASSIFIERS - if (!kindFilter.acceptsKinds(DescriptorKindFilter.CLASSIFIERS_MASK or DescriptorKindFilter.NON_SINGLETON_CLASSIFIERS_MASK)) - emptyList() - - // we don't use implementation from super which caches all descriptors and does not use filters - val allContributedDescriptors = allDescriptors() - return allContributedDescriptors.filter { it is ClassDescriptor && nameFilter(it.name) }.toList() + return if (!kindFilter.acceptsKinds(DescriptorKindFilter.CLASSIFIERS_MASK or DescriptorKindFilter.NON_SINGLETON_CLASSIFIERS_MASK)) { + emptyList() + } else { + // we don't use implementation from super which caches all descriptors and does not use filters + allDescriptors().filter { it is ClassDescriptor && nameFilter(it.name) }.toList() + } } }