Fix for rubish labels inside captured field access chains

This commit is contained in:
Mikhael Bogdanov
2014-03-12 19:11:04 +04:00
parent c95001370a
commit 768c565d3f
2 changed files with 11 additions and 4 deletions
@@ -83,10 +83,13 @@ public class FieldRemapper {
insnNode.name = "$$$" + insnNode.name;
insnNode.setOpcode(Opcodes.GETSTATIC);
for (int i = 0; i < currentInstruction; i++) {
AbstractInsnNode toRemove = capturedFieldAccess.get(i);
node.instructions.remove(toRemove);
AbstractInsnNode next = capturedFieldAccess.get(0);
while (next != insnNode) {
AbstractInsnNode toDelete = next;
next = next.getNext();
node.instructions.remove(toDelete);
}
transformed = capturedFieldAccess.get(capturedFieldAccess.size() - 1);
}
}
@@ -429,7 +429,11 @@ public class MethodInliner {
List<AbstractInsnNode> fieldAccessChain = new ArrayList<AbstractInsnNode>();
fieldAccessChain.add(aload0);
AbstractInsnNode next = aload0.getNext();
while (next != null && next instanceof FieldInsnNode) {
while (next != null && next instanceof FieldInsnNode || next instanceof LabelNode) {
if (next instanceof LabelNode) {
next = next.getNext();
continue; //it will be delete on transformation
}
fieldAccessChain.add(next);
if ("this$0".equals(((FieldInsnNode) next).name)) {
next = next.getNext();