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 2b2439a73be..f2580c23531 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 @@ -160,18 +160,25 @@ class LazyJavaPackageScope( } } - override fun computeFunctionNames(kindFilter: DescriptorKindFilter, nameFilter: ((Name) -> Boolean)?): Set { - return emptySet() - } + override fun computeFunctionNames(kindFilter: DescriptorKindFilter, nameFilter: ((Name) -> Boolean)?): Set = emptySet() override fun computeNonDeclaredFunctions(result: MutableCollection, name: Name) { } override fun computePropertyNames(kindFilter: DescriptorKindFilter, nameFilter: ((Name) -> Boolean)?) = emptySet() - // we don't use implementation from super which caches all descriptors and does not use filters override fun getContributedDescriptors( kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean - ): Collection = computeDescriptors(kindFilter, nameFilter) + ): Collection { + // 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() + } }