Add module name JVM extensions to class/package in kotlinx-metadata-jvm
#KT-31308 Fixed
This commit is contained in:
@@ -514,7 +514,11 @@ private fun StringBuilder.appendFlags(flags: Flags, map: Map<Flag, String>) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun StringBuilder.appendLocalDelegatedProperties(localDelegatedProperties: List<StringBuilder>) {
|
||||
private fun StringBuilder.appendDeclarationContainerExtensions(
|
||||
settings: KotlinpSettings,
|
||||
localDelegatedProperties: List<StringBuilder>,
|
||||
moduleName: String?
|
||||
) {
|
||||
for ((i, sb) in localDelegatedProperties.withIndex()) {
|
||||
appendln()
|
||||
appendln(" // local delegated property #$i")
|
||||
@@ -527,6 +531,11 @@ private fun StringBuilder.appendLocalDelegatedProperties(localDelegatedPropertie
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.isVerbose && moduleName != null) {
|
||||
appendln()
|
||||
appendln(" // module name: $moduleName")
|
||||
}
|
||||
}
|
||||
|
||||
interface AbstractPrinter<in T : KotlinClassMetadata> {
|
||||
@@ -615,6 +624,7 @@ class ClassPrinter(private val settings: KotlinpSettings) : KmClassVisitor(), Ab
|
||||
if (type != JvmClassExtensionVisitor.TYPE) return null
|
||||
return object : JvmClassExtensionVisitor() {
|
||||
private val localDelegatedProperties = mutableListOf<StringBuilder>()
|
||||
private var moduleName: String? = null
|
||||
|
||||
override fun visitAnonymousObjectOriginName(internalName: String) {
|
||||
anonymousObjectOriginName = internalName
|
||||
@@ -626,8 +636,12 @@ class ClassPrinter(private val settings: KotlinpSettings) : KmClassVisitor(), Ab
|
||||
settings, StringBuilder().also { localDelegatedProperties.add(it) }, flags, name, getterFlags, setterFlags
|
||||
)
|
||||
|
||||
override fun visitModuleName(name: String) {
|
||||
moduleName = name
|
||||
}
|
||||
|
||||
override fun visitEnd() {
|
||||
sb.appendLocalDelegatedProperties(localDelegatedProperties)
|
||||
sb.appendDeclarationContainerExtensions(settings, localDelegatedProperties, moduleName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -660,6 +674,7 @@ abstract class PackagePrinter(private val settings: KotlinpSettings) : KmPackage
|
||||
if (type != JvmPackageExtensionVisitor.TYPE) return null
|
||||
return object : JvmPackageExtensionVisitor() {
|
||||
private val localDelegatedProperties = mutableListOf<StringBuilder>()
|
||||
private var moduleName: String? = null
|
||||
|
||||
override fun visitLocalDelegatedProperty(
|
||||
flags: Flags, name: String, getterFlags: Flags, setterFlags: Flags
|
||||
@@ -668,7 +683,7 @@ abstract class PackagePrinter(private val settings: KotlinpSettings) : KmPackage
|
||||
)
|
||||
|
||||
override fun visitEnd() {
|
||||
sb.appendLocalDelegatedProperties(localDelegatedProperties)
|
||||
sb.appendDeclarationContainerExtensions(settings, localDelegatedProperties, moduleName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ public final annotation class A : kotlin/Annotation {
|
||||
// getter: za()[Z
|
||||
public final val za: kotlin/BooleanArray
|
||||
public final get
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// B.class
|
||||
// ------------------------------------------
|
||||
@@ -136,6 +138,8 @@ public final annotation class B : kotlin/Annotation {
|
||||
// getter: value()Ljava/lang/String;
|
||||
public final val value: kotlin/String
|
||||
public final get
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// C.class
|
||||
// ------------------------------------------
|
||||
@@ -149,6 +153,8 @@ public final class C : kotlin/Any {
|
||||
|
||||
// signature: returnTypeAnnotation()V
|
||||
public final fun returnTypeAnnotation(): @A(z = true, c = 'x', b = 1.toByte(), s = 42.toShort(), i = 42424242, f = -2.72f, j = 239239239239239L, d = 3.14, ui = 1u, ub = 255.toUByte(), us = 3.toUShort(), ul = 4uL, ui_max = 4294967295u, ub_max = 255.toUByte(), us_max = 65535.toUShort(), ul_max = 18446744073709551615uL, za = [true], ca = ['\''], ba = [1.toByte()], sa = [42.toShort()], ia = [42424242], fa = [-2.72f], ja = [239239239239239L], da = [3.14], str = "aba\ncaba'\"\t\u0001\u0002ꙮ", enum = kotlin/annotation/AnnotationTarget.CLASS, klass = C::class, anno = B(value = "aba\ncaba'\"\t\u0001\u0002ꙮ")) kotlin/Unit
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// JvmNamed.class
|
||||
// ------------------------------------------
|
||||
@@ -160,6 +166,8 @@ public final annotation class JvmNamed : kotlin/Annotation {
|
||||
// getter: uglyJvmName()Ljava/lang/String;
|
||||
public final val value: kotlin/String
|
||||
public final get
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -4,6 +4,8 @@ public final class A : kotlin/Any {
|
||||
|
||||
// signature: <init>()V
|
||||
public /* primary */ constructor()
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$L.class
|
||||
// ------------------------------------------
|
||||
@@ -16,6 +18,8 @@ local final class .A$L<T#0 /* T */> : kotlin/Any {
|
||||
public final fun x(l: .A$L<.A$L<T#0>.I>): kotlin/Unit
|
||||
|
||||
// nested class: I
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$L$I.class
|
||||
// ------------------------------------------
|
||||
@@ -23,6 +27,8 @@ local final inner class .A$L.I : kotlin/Any {
|
||||
|
||||
// signature: <init>(LA$L;)V
|
||||
public /* primary */ constructor()
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -19,6 +19,8 @@ public final class Class : kotlin/Any {
|
||||
// local delegated property #2
|
||||
// local final /* delegated */ val local6: kotlin/Int
|
||||
// local final get
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// Class$f$1.class
|
||||
// ------------------------------------------
|
||||
@@ -41,6 +43,8 @@ public final class Delegate<T#0 /* T */> : kotlin/Any {
|
||||
// getter: getValue()Ljava/lang/Object;
|
||||
public final val value: T#0?
|
||||
public final get
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// LocalDelegatedPropertiesKt.class
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -7,16 +7,22 @@ public abstract interface A : kotlin/Any {
|
||||
// nested class: B
|
||||
|
||||
// nested class: D
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$B.class
|
||||
// ------------------------------------------
|
||||
public abstract interface A.B : kotlin/Any {
|
||||
|
||||
// nested class: C
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$B$C.class
|
||||
// ------------------------------------------
|
||||
public abstract interface A.B.C : kotlin/Any {
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$D.class
|
||||
// ------------------------------------------
|
||||
@@ -28,6 +34,8 @@ public final companion object A.D : kotlin/Any {
|
||||
// nested class: E
|
||||
|
||||
// nested class: F
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$D$E.class
|
||||
// ------------------------------------------
|
||||
@@ -39,6 +47,8 @@ public final enum class A.D.E : kotlin/Enum<A.D.E> {
|
||||
E1,
|
||||
|
||||
E2,
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$D$F.class
|
||||
// ------------------------------------------
|
||||
@@ -50,6 +60,8 @@ public sealed class A.D.F : kotlin/Any {
|
||||
// nested class: G
|
||||
|
||||
// sealed subclass: A.D.F.G
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$D$F$G.class
|
||||
// ------------------------------------------
|
||||
@@ -57,6 +69,8 @@ public final class A.D.F.G : A.D.F {
|
||||
|
||||
// signature: <init>()V
|
||||
public /* primary */ constructor()
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -10,6 +10,8 @@ public final class PlatformType : kotlin/Any {
|
||||
|
||||
// signature: nullability()Ljava/io/File;
|
||||
public final fun nullability(): java/io/File!
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -34,6 +34,8 @@ public final class C : kotlin/Any {
|
||||
// getter: getDelegated(Ljava/lang/Number;)Ljava/util/List;
|
||||
public final /* delegated */ val <T#0 /* T */ : kotlin/Number> T#0.delegated: kotlin/collections/List<kotlin/Nothing>
|
||||
public final /* non-default */ get
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -26,6 +26,8 @@ public final class SimpleClass<in T#0 /* A */> : kotlin/Any {
|
||||
public final var x: kotlin/Long
|
||||
public final /* non-default */ external get
|
||||
public final /* non-default */ set(<set-?>: kotlin/Long)
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -9,6 +9,8 @@ public final class A<T#0 /* T */> : kotlin/Any {
|
||||
public final fun <T#1 /* T */> a(t: T#1): kotlin/Unit
|
||||
|
||||
// nested class: B
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$B.class
|
||||
// ------------------------------------------
|
||||
@@ -24,6 +26,8 @@ public final inner class A.B<T#1 /* U */, T#2 /* V */ : T#1> : kotlin/Any {
|
||||
public final fun bb(t: T#0): kotlin/Unit
|
||||
|
||||
// nested class: C
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// A$B$C.class
|
||||
// ------------------------------------------
|
||||
@@ -40,6 +44,8 @@ public final inner class A.B.C<T#3 /* T */, T#4 /* U */> : kotlin/Any {
|
||||
|
||||
// signature: z(LA$B$C;)V
|
||||
public final fun z(c: A<kotlin/Int>.B<kotlin/Any, kotlin/Byte>.C<kotlin/Unit, kotlin/Long>): kotlin/Unit
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
|
||||
@@ -5,6 +5,8 @@ public final class test/Klass : kotlin/Any {
|
||||
|
||||
// signature: <init>()V
|
||||
public /* primary */ constructor()
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// test/Konstructor.class
|
||||
// ------------------------------------------
|
||||
@@ -13,6 +15,8 @@ public final class test/Konstructor : kotlin/Any {
|
||||
// requires language version 42.0.0 (level=WARNING, errorCode=42, message="Konstructor must not be used!")
|
||||
// signature: <init>()V
|
||||
public /* primary */ constructor()
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// test/VersionRequirementKt.class
|
||||
// ------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user