Fix reflection on enhanced Java methods, call getOriginal()
Also use the provided mechanism for binding overrides instead of a custom for loop, because it also binds corresponding value parameters
This commit is contained in:
+1
-8
@@ -92,8 +92,6 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public JavaMethodDescriptor enhance(
|
public JavaMethodDescriptor enhance(
|
||||||
@@ -109,16 +107,11 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
|
|||||||
// 2. copies method's type parameters (with new containing declaration) and properly substitute to them in value parameters, return type and etc.
|
// 2. copies method's type parameters (with new containing declaration) and properly substitute to them in value parameters, return type and etc.
|
||||||
JavaMethodDescriptor enhancedMethod = (JavaMethodDescriptor) doSubstitute(
|
JavaMethodDescriptor enhancedMethod = (JavaMethodDescriptor) doSubstitute(
|
||||||
TypeSubstitutor.EMPTY, getContainingDeclaration(), getModality(), getVisibility(), getOriginal(),
|
TypeSubstitutor.EMPTY, getContainingDeclaration(), getModality(), getVisibility(), getOriginal(),
|
||||||
/* copyOverrides = */ false, getKind(),
|
/* copyOverrides = */ true, getKind(),
|
||||||
enhancedValueParameters, enhancedReceiverType, enhancedReturnType
|
enhancedValueParameters, enhancedReceiverType, enhancedReturnType
|
||||||
);
|
);
|
||||||
|
|
||||||
assert enhancedMethod != null : "null after substitution while enhancing " + toString();
|
assert enhancedMethod != null : "null after substitution while enhancing " + toString();
|
||||||
|
|
||||||
for (FunctionDescriptor overridden : getOverriddenDescriptors()) {
|
|
||||||
enhancedMethod.addOverriddenDescriptor(overridden);
|
|
||||||
}
|
|
||||||
|
|
||||||
return enhancedMethod;
|
return enhancedMethod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
|||||||
import kotlin.reflect.KotlinReflectionInternalError
|
import kotlin.reflect.KotlinReflectionInternalError
|
||||||
|
|
||||||
object RuntimeTypeMapper {
|
object RuntimeTypeMapper {
|
||||||
fun mapSignature(function: FunctionDescriptor): String {
|
fun mapSignature(possiblySubstitutedFunction: FunctionDescriptor): String {
|
||||||
|
val function = possiblySubstitutedFunction.getOriginal()
|
||||||
|
|
||||||
if (function is DeserializedCallableMemberDescriptor) {
|
if (function is DeserializedCallableMemberDescriptor) {
|
||||||
val proto = function.proto
|
val proto = function.proto
|
||||||
if (!proto.hasExtension(JvmProtoBuf.methodSignature)) {
|
if (!proto.hasExtension(JvmProtoBuf.methodSignature)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user