Move PackagePartProvider to module descriptors.jvm
This commit is contained in:
@@ -17,7 +17,10 @@
|
||||
package org.jetbrains.kotlin.load.java.lazy
|
||||
|
||||
import org.jetbrains.kotlin.builtins.ReflectionTypes
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.ClassOrPackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SupertypeLoopChecker
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
@@ -36,6 +39,7 @@ import org.jetbrains.kotlin.load.java.typeEnhancement.NullabilityQualifierWithMi
|
||||
import org.jetbrains.kotlin.load.java.typeEnhancement.SignatureEnhancement
|
||||
import org.jetbrains.kotlin.load.kotlin.DeserializedDescriptorResolver
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinClassFinder
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ErrorReporter
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import java.util.*
|
||||
@@ -52,7 +56,7 @@ class JavaResolverComponents(
|
||||
val samConversionResolver: SamConversionResolver,
|
||||
val sourceElementFactory: JavaSourceElementFactory,
|
||||
val moduleClassResolver: ModuleClassResolver,
|
||||
val packageMapper: PackagePartProvider,
|
||||
val packagePartProvider: PackagePartProvider,
|
||||
val supertypeLoopChecker: SupertypeLoopChecker,
|
||||
val lookupTracker: LookupTracker,
|
||||
val module: ModuleDescriptor,
|
||||
@@ -68,9 +72,8 @@ class JavaResolverComponents(
|
||||
storageManager, finder, kotlinClassFinder, deserializedDescriptorResolver,
|
||||
signaturePropagator, errorReporter, javaResolverCache,
|
||||
javaPropertyInitializerEvaluator, samConversionResolver, sourceElementFactory,
|
||||
moduleClassResolver, packageMapper, supertypeLoopChecker, lookupTracker, module, reflectionTypes,
|
||||
annotationTypeQualifierResolver, signatureEnhancement, javaClassesTracker,
|
||||
settings
|
||||
moduleClassResolver, packagePartProvider, supertypeLoopChecker, lookupTracker, module, reflectionTypes,
|
||||
annotationTypeQualifierResolver, signatureEnhancement, javaClassesTracker, settings
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class LazyJavaPackageFragment(
|
||||
private val c = outerContext.childForClassOrPackage(this)
|
||||
|
||||
internal val binaryClasses by c.storageManager.createLazyValue {
|
||||
c.components.packageMapper.findPackageParts(fqName.asString()).mapNotNull { partName ->
|
||||
c.components.packagePartProvider.findPackageParts(fqName.asString()).mapNotNull { partName ->
|
||||
val classId = ClassId.topLevel(JvmClassName.byInternalName(partName).fqNameForTopLevelClassMaybeWithDollars)
|
||||
c.components.kotlinClassFinder.findKotlinClass(classId)?.let { partName to it }
|
||||
}.toMap()
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.load.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
interface PackagePartProvider {
|
||||
/**
|
||||
* @return JVM internal names of package parts existing in the package with the given FQ name.
|
||||
*
|
||||
* For example, if a file named foo.kt in package org.test is compiled to a library, PackagePartProvider for such library
|
||||
* must return the list `["org/test/FooKt"]` for the query `"org.test"`
|
||||
* (in case the file is not annotated with @JvmName, @JvmPackageName or @JvmMultifileClass).
|
||||
*/
|
||||
fun findPackageParts(packageFqName: String): List<String>
|
||||
|
||||
fun getAnnotationsOnBinaryModule(moduleName: String): List<ClassId>
|
||||
|
||||
object Empty : PackagePartProvider {
|
||||
override fun findPackageParts(packageFqName: String): List<String> = emptyList()
|
||||
|
||||
override fun getAnnotationsOnBinaryModule(moduleName: String): List<ClassId> = emptyList()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user