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:
Alexander Udalov
2015-07-14 13:54:45 +03:00
parent 81ef1c19d8
commit b0db9c5b03
2 changed files with 4 additions and 9 deletions
@@ -92,8 +92,6 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
return result;
}
@Override
@NotNull
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.
JavaMethodDescriptor enhancedMethod = (JavaMethodDescriptor) doSubstitute(
TypeSubstitutor.EMPTY, getContainingDeclaration(), getModality(), getVisibility(), getOriginal(),
/* copyOverrides = */ false, getKind(),
/* copyOverrides = */ true, getKind(),
enhancedValueParameters, enhancedReceiverType, enhancedReturnType
);
assert enhancedMethod != null : "null after substitution while enhancing " + toString();
for (FunctionDescriptor overridden : getOverriddenDescriptors()) {
enhancedMethod.addOverriddenDescriptor(overridden);
}
return enhancedMethod;
}
}