Cleanup: apply "cascade if..." inspection (+ some others)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
9c06739594
commit
1d2017b0fc
@@ -208,29 +208,33 @@ internal object RuntimeTypeMapper {
|
||||
|
||||
fun mapPropertySignature(possiblyOverriddenProperty: PropertyDescriptor): JvmPropertySignature {
|
||||
val property = DescriptorUtils.unwrapFakeOverride(possiblyOverriddenProperty).original
|
||||
if (property is DeserializedPropertyDescriptor) {
|
||||
val proto = property.proto
|
||||
if (!proto.hasExtension(JvmProtoBuf.propertySignature)) {
|
||||
// If this property has no JVM signature, it must be from built-ins
|
||||
throw KotlinReflectionInternalError("Reflection on built-in Kotlin types is not yet fully supported. " +
|
||||
"No metadata found for $property")
|
||||
}
|
||||
return JvmPropertySignature.KotlinProperty(
|
||||
property, proto, proto.getExtension(JvmProtoBuf.propertySignature), property.nameResolver, property.typeTable
|
||||
)
|
||||
}
|
||||
else if (property is JavaPropertyDescriptor) {
|
||||
val element = (property.source as? JavaSourceElement)?.javaElement
|
||||
when (element) {
|
||||
is ReflectJavaField -> return JvmPropertySignature.JavaField(element.member)
|
||||
is ReflectJavaMethod -> return JvmPropertySignature.JavaMethodProperty(
|
||||
element.member,
|
||||
((property.setter?.source as? JavaSourceElement)?.javaElement as? ReflectJavaMethod)?.member
|
||||
return when (property) {
|
||||
is DeserializedPropertyDescriptor -> {
|
||||
val proto = property.proto
|
||||
if (!proto.hasExtension(JvmProtoBuf.propertySignature)) {
|
||||
// If this property has no JVM signature, it must be from built-ins
|
||||
throw KotlinReflectionInternalError("Reflection on built-in Kotlin types is not yet fully supported. " +
|
||||
"No metadata found for $property")
|
||||
}
|
||||
JvmPropertySignature.KotlinProperty(
|
||||
property, proto, proto.getExtension(JvmProtoBuf.propertySignature), property.nameResolver, property.typeTable
|
||||
)
|
||||
else -> throw KotlinReflectionInternalError("Incorrect resolution sequence for Java field $property (source = $element)")
|
||||
}
|
||||
is JavaPropertyDescriptor -> {
|
||||
val element = (property.source as? JavaSourceElement)?.javaElement
|
||||
when (element) {
|
||||
is ReflectJavaField -> JvmPropertySignature.JavaField(element.member)
|
||||
is ReflectJavaMethod -> JvmPropertySignature.JavaMethodProperty(
|
||||
element.member,
|
||||
((property.setter?.source as? JavaSourceElement)?.javaElement as? ReflectJavaMethod)?.member
|
||||
)
|
||||
else -> throw KotlinReflectionInternalError("Incorrect resolution sequence for Java field $property (source = $element)")
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
throw KotlinReflectionInternalError("Unknown origin of $property (${property.javaClass})")
|
||||
}
|
||||
}
|
||||
else throw KotlinReflectionInternalError("Unknown origin of $property (${property.javaClass})")
|
||||
}
|
||||
|
||||
private fun mapIntrinsicFunctionSignature(function: FunctionDescriptor): JvmFunctionSignature? {
|
||||
|
||||
Reference in New Issue
Block a user