diff --git a/base/src/main/java/proguard/classfile/editor/InstructionSequenceReplacer.java b/base/src/main/java/proguard/classfile/editor/InstructionSequenceReplacer.java index 103b6b21..24773f50 100644 --- a/base/src/main/java/proguard/classfile/editor/InstructionSequenceReplacer.java +++ b/base/src/main/java/proguard/classfile/editor/InstructionSequenceReplacer.java @@ -396,13 +396,45 @@ public Instruction create(Clazz clazz, CodeAttribute codeAttribute, int index) { instructionSequenceMatcher.matchedInstructionOffset(matchedInstructionIndex); // Create the instruction. - replacementInstructions[index].accept( - clazz, null, codeAttribute, matchedInstructionOffset, this); + Instruction insn = replacementInstructions[index]/*.accept(clazz, null, codeAttribute, matchedInstructionOffset, this)*/; + + // fix TeaVM analyzer bug, we can't have nice things + if (insn instanceof SimpleInstruction) { + this.visitSimpleInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (SimpleInstruction) insn); + } else if (insn instanceof VariableInstruction) { + this.visitVariableInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (VariableInstruction) insn); + } else if (insn instanceof ConstantInstruction) { + this.visitConstantInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (ConstantInstruction) insn); + } else if (insn instanceof BranchInstruction) { + this.visitBranchInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (BranchInstruction) insn); + } else if (insn instanceof TableSwitchInstruction) { + this.visitTableSwitchInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (TableSwitchInstruction) insn); + } else if (insn instanceof LookUpSwitchInstruction) { + this.visitLookUpSwitchInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (LookUpSwitchInstruction) insn); + } else if (insn instanceof Catch) { + this.visitCatchInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (Catch) insn); + } else if (insn instanceof Label) { + this.visitLabelInstruction(clazz, null, codeAttribute, matchedInstructionOffset, (Label) insn); + } else { + this.visitAnyInstruction(clazz, null, codeAttribute, matchedInstructionOffset, insn); + } // Return it. return replacementInstruction; } + @SuppressWarnings("DataFlowIssue") + private void teaVMFix0() { + this.visitSimpleInstruction(null, null, null, 0, null); + this.visitVariableInstruction(null, null, null, 0, null); + this.visitConstantInstruction(null, null, null, 0, null); + this.visitBranchInstruction(null, null, null, 0, null); + this.visitTableSwitchInstruction(null, null, null, 0, null); + this.visitLookUpSwitchInstruction(null, null, null, 0, null); + this.visitLabelInstruction(null, null, null, 0, null); + this.visitCatchInstruction(null, null, null, 0, null); + } + // Implementations for InstructionVisitor. @Override