Move getterName/setterName to JvmAbi
Reuse in RuntimeTypeMapper in reflection
This commit is contained in:
@@ -111,7 +111,7 @@ object RuntimeTypeMapper {
|
||||
val field = signature.getField()
|
||||
|
||||
// TODO: some kind of test on the Java Bean convention?
|
||||
return getterName(nameResolver.getString(field.getName())) +
|
||||
return JvmAbi.getterName(nameResolver.getString(field.getName())) +
|
||||
"()" +
|
||||
deserializer.typeDescriptor(field.getType())
|
||||
}
|
||||
@@ -120,7 +120,7 @@ object RuntimeTypeMapper {
|
||||
throw KotlinReflectionInternalError("Incorrect resolution sequence for Java field $property")
|
||||
|
||||
return StringBuilder {
|
||||
append(getterName(method.getName().asString()))
|
||||
append(JvmAbi.getterName(method.getName().asString()))
|
||||
append("()")
|
||||
appendJavaType(method.getType())
|
||||
}.toString()
|
||||
@@ -128,14 +128,6 @@ object RuntimeTypeMapper {
|
||||
else throw KotlinReflectionInternalError("Unknown origin of $property (${property.javaClass})")
|
||||
}
|
||||
|
||||
private fun getterName(propertyName: String): String {
|
||||
return JvmAbi.GETTER_PREFIX + propertyName.capitalizeWithJavaBeanConvention()
|
||||
}
|
||||
|
||||
private fun String.capitalizeWithJavaBeanConvention(): String {
|
||||
return if (length() > 1 && this[1].isUpperCase()) this else capitalize()
|
||||
}
|
||||
|
||||
fun mapJvmClassToKotlinClassId(klass: Class<*>): ClassId {
|
||||
if (klass.isArray()) {
|
||||
klass.getComponentType().primitiveType?.let {
|
||||
|
||||
Reference in New Issue
Block a user