Fix for "NoSuchFieldError: this$0$inlined"

This commit is contained in:
Mikhael Bogdanov
2014-03-09 11:19:15 +04:00
parent 4771986b32
commit 7fb9de2654
3 changed files with 25 additions and 1 deletions
@@ -272,6 +272,10 @@ public class LambdaTransformer {
}
public static String getNewFieldName(String oldName) {
if (oldName.equals("this$0")) {
//"this$0" couldn't clash and we should keep this name invariant for further transformations
return oldName;
}
return oldName + "$inlined";
}
}
@@ -148,7 +148,7 @@ public class RegeneratedLambdaFieldRemapper extends LambdaFieldRemapper {
FieldInsnNode next = (FieldInsnNode) nextInstruction;
node.instructions.remove(next.getPrevious());
next.owner = Type.getType(((FieldInsnNode) previous).desc).getInternalName();
next.name = node.name.equals("this$0") ? node.name : LambdaTransformer.getNewFieldName(next.name);
next.name = LambdaTransformer.getNewFieldName(next.name);
return next;
}