Add LocalVariablesSorter to MethodRemaper in RemappingClassBuilder to keep old behavior

#KT-27774 In Progress
This commit is contained in:
Mikhael Bogdanov
2018-10-25 15:14:09 +02:00
parent 0468a354e0
commit 0edd2d326b
2 changed files with 9 additions and 1 deletions
@@ -151,6 +151,7 @@ class MethodInliner(
// MethodRemapper doesn't extends LocalVariablesSorter, but RemappingMethodAdapter does.
// So wrapping with LocalVariablesSorter to keep old behavior
// TODO: investigate LocalVariablesSorter removing (see also same code in RemappingClassBuilder.java)
val remappingMethodAdapter = MethodRemapper(
LocalVariablesSorter(
resultNode.access,
@@ -82,8 +82,15 @@ public class RemappingClassBuilder extends DelegatingClassBuilder {
@Nullable String signature,
@Nullable String[] exceptions
) {
String newDescriptor = remapper.mapMethodDesc(desc);
// MethodRemapper doesn't extends LocalVariablesSorter, but RemappingMethodAdapter does.
// So wrapping with LocalVariablesSorter to keep old behavior.
// TODO: investigate LocalVariablesSorter removing (see also same code in MethodInliner)
return new MethodRemapper(
builder.newMethod(origin, access, name, remapper.mapMethodDesc(desc), remapper.mapSignature(signature, false), exceptions),
new LocalVariablesSorter(
access, newDescriptor,
builder.newMethod(origin, access, name, newDescriptor, remapper.mapSignature(signature, false),
exceptions)),
remapper
);
}