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:
@@ -50,6 +50,7 @@ public final class JvmAnnotationNames {
|
||||
public static final String MULTIFILE_CLASS_NAME_FIELD_NAME = "multifileClassName";
|
||||
public static final String DATA_FIELD_NAME = "data";
|
||||
public static final String STRINGS_FIELD_NAME = "strings";
|
||||
public static final String MODULE_NAME_FIELD_NAME = "moduleName";
|
||||
public static final Name DEFAULT_ANNOTATION_MEMBER_NAME = Name.identifier("value");
|
||||
public static final Name DEPRECATED_ANNOTATION_MESSAGE = Name.identifier("message");
|
||||
public static final Name TARGET_ANNOTATION_MEMBER_NAME = Name.identifier("allowedTargets");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,6 +29,8 @@ public @interface KotlinCallable {
|
||||
|
||||
int[] version() default {};
|
||||
|
||||
String moduleName() default "main";
|
||||
|
||||
String[] data();
|
||||
|
||||
String[] strings();
|
||||
|
||||
@@ -29,6 +29,8 @@ public @interface KotlinClass {
|
||||
|
||||
int[] version() default {};
|
||||
|
||||
String moduleName() default "main";
|
||||
|
||||
String[] data();
|
||||
|
||||
String[] strings();
|
||||
|
||||
@@ -29,6 +29,8 @@ public @interface KotlinFileFacade {
|
||||
|
||||
int[] version() default {};
|
||||
|
||||
String moduleName() default "main";
|
||||
|
||||
String[] data();
|
||||
|
||||
String[] strings();
|
||||
|
||||
@@ -29,6 +29,8 @@ public @interface KotlinMultifileClass {
|
||||
|
||||
int[] version() default {};
|
||||
|
||||
String moduleName() default "main";
|
||||
|
||||
String[] filePartClassNames();
|
||||
|
||||
String[] strings();
|
||||
|
||||
@@ -28,4 +28,6 @@ public @interface KotlinSyntheticClass {
|
||||
int abiVersion();
|
||||
|
||||
int[] version() default {};
|
||||
|
||||
String moduleName() default "main";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user