Fixed (probably) the ctor/initialiser overlap issue with JDK8 classes

This commit is contained in:
Mumfrey committed 2015-02-22 21:35:22 +00:00
1 parent 7850fb3ee1
commit 9d9c2238e8
1 file changed
+13 -1
@@ -724,12 +724,20 @@ public class MixinTransformer extends TreeTransformer {
int line = 0;
InsnList initialiser = new InsnList();
boolean gatherNodes = false;
int trimAtOpcode = -1;
LabelNode optionalInsn = null;
for (Iterator<AbstractInsnNode> iter = ctor.instructions.iterator(init.marker); iter.hasNext();) {
AbstractInsnNode insn = iter.next();
if (insn instanceof LineNumberNode) {
line = ((LineNumberNode)insn).line;
gatherNodes = init.excludes(line);
AbstractInsnNode next = ctor.instructions.get(ctor.instructions.indexOf(insn) + 1);
if (line == init.end && next.getOpcode() != Opcodes.RETURN) {
gatherNodes = true;
trimAtOpcode = Opcodes.RETURN;
} else {
gatherNodes = init.excludes(line);
trimAtOpcode = -1;
}
} else if (gatherNodes) {
if (optionalInsn != null) {
initialiser.add(optionalInsn);
@@ -740,6 +748,10 @@ public class MixinTransformer extends TreeTransformer {
optionalInsn = (LabelNode)insn;
} else {
int opcode = insn.getOpcode();
if (opcode == trimAtOpcode) {
trimAtOpcode = -1;
continue;
}
for (int ivalidOp : MixinTransformer.INITIALISER_OPCODE_BLACKLIST) {
if (opcode == ivalidOp) {
// At the moment I don't handle any transient locals because I haven't seen any in the wild, but let's avoid writing