@@ -7,9 +7,7 @@ import kotlinx.metadata.ClassKind
7
7
import kotlinx.metadata.ClassName
8
8
import kotlinx.metadata.KmClass
9
9
import kotlinx.metadata.KmFunction
10
- import kotlinx.metadata.KmProperty
11
10
import kotlinx.metadata.isNullable
12
- import kotlinx.metadata.jvm.getterSignature
13
11
import kotlinx.metadata.jvm.signature
14
12
import kotlinx.metadata.kind
15
13
import java.lang.reflect.Constructor
@@ -40,7 +38,7 @@ internal sealed interface JmClass {
40
38
val constructors: List <JmConstructor >
41
39
val sealedSubclasses: List <ClassName >
42
40
val propertyNameSet: Set <String >
43
- val properties: List <KmProperty >
41
+ val properties: List <JmProperty >
44
42
val companion : CompanionObject ?
45
43
// endregion
46
44
@@ -49,8 +47,8 @@ internal sealed interface JmClass {
49
47
// endregion
50
48
51
49
fun findKmConstructor (constructor : Constructor <* >): JmConstructor ?
52
- fun findPropertyByField (field : Field ): KmProperty ?
53
- fun findPropertyByGetter (getter : Method ): KmProperty ?
50
+ fun findPropertyByField (field : Field ): JmProperty ?
51
+ fun findPropertyByGetter (getter : Method ): JmProperty ?
54
52
}
55
53
56
54
private class JmClassImpl (
@@ -59,10 +57,10 @@ private class JmClassImpl(
59
57
superJmClass : JmClass ? ,
60
58
interfaceJmClasses : List <JmClass >
61
59
) : JmClass {
62
- private val allPropsMap: Map <String , KmProperty >
60
+ private val allPropsMap: Map <String , JmProperty >
63
61
64
62
// Defined as non-lazy because it is always read in both serialization and deserialization
65
- override val properties: List <KmProperty >
63
+ override val properties: List <JmProperty >
66
64
67
65
private val companionPropName: String? = kmClass.companionObject
68
66
override val kind: ClassKind = kmClass.kind
@@ -77,7 +75,7 @@ private class JmClassImpl(
77
75
// it is necessary to obtain a more specific type, so always add it from the abstract class first.
78
76
val tempPropsMap = ((superJmClass as JmClassImpl ? )?.allPropsMap?.toMutableMap() ? : mutableMapOf ()).apply {
79
77
kmClass.properties.forEach {
80
- this [it.name] = it
78
+ this [it.name] = JmProperty (it)
81
79
}
82
80
}
83
81
@@ -119,11 +117,11 @@ private class JmClassImpl(
119
117
}
120
118
121
119
// Field name always matches property name
122
- override fun findPropertyByField (field : Field ): KmProperty ? = allPropsMap[field.name]
120
+ override fun findPropertyByField (field : Field ): JmProperty ? = allPropsMap[field.name]
123
121
124
- override fun findPropertyByGetter (getter : Method ): KmProperty ? {
122
+ override fun findPropertyByGetter (getter : Method ): JmProperty ? {
125
123
val getterName = getter.name
126
- return properties.find { it.getterSignature?.name == getterName }
124
+ return properties.find { it.getterName == getterName }
127
125
}
128
126
}
129
127
0 commit comments