Write module name to metadata, fix reflection for file facades
Module name will be used for proper introspection of internal members
This commit is contained in:
@@ -29,11 +29,9 @@ import kotlin.reflect.KPackage
|
||||
|
||||
internal class KPackageImpl(override val jClass: Class<*>, val moduleName: String) : KDeclarationContainerImpl(), KPackage {
|
||||
val descriptor by ReflectProperties.lazySoft {
|
||||
val moduleData = jClass.getOrCreateModule()
|
||||
val moduleData = moduleData
|
||||
moduleData.packageFacadeProvider.registerModule(moduleName)
|
||||
val fqName = jClass.classId.getPackageFqName()
|
||||
|
||||
moduleData.module.getPackage(fqName)
|
||||
moduleData.module.getPackage(jClass.classId.packageFqName)
|
||||
}
|
||||
|
||||
internal val scope: JetScope get() = descriptor.memberScope
|
||||
|
||||
@@ -103,7 +103,13 @@ public val Method.kotlinFunction: KFunction<*>?
|
||||
if (isSynthetic) return null
|
||||
|
||||
if (Modifier.isStatic(modifiers)) {
|
||||
// TODO: support file facades & multifile classes
|
||||
// TODO: support multifile classes
|
||||
|
||||
val fileFacade = declaringClass.getAnnotation(KotlinFileFacade::class.java)
|
||||
if (fileFacade != null) {
|
||||
val kotlinPackage = Reflection.getOrCreateKotlinPackage(declaringClass, fileFacade.moduleName)
|
||||
return kotlinPackage.functions.firstOrNull { it.javaMethod == this }
|
||||
}
|
||||
|
||||
// For static bridge method generated for a jvmStatic function in the companion object, also try to find the latter
|
||||
val companion = declaringClass.kotlin.companionObject
|
||||
|
||||
Reference in New Issue
Block a user