예제 #1
0
 public void visitAnyInstruction(
     Clazz clazz,
     Method method,
     CodeAttribute codeAttribute,
     int offset,
     Instruction instruction) {
   // Add the instruction.
   codeAttributeComposer.appendInstruction(offset, instruction);
 }
예제 #2
0
  public void visitConstantInstruction(
      Clazz clazz,
      Method method,
      CodeAttribute codeAttribute,
      int offset,
      ConstantInstruction constantInstruction) {
    // Create a copy of the instruction.
    Instruction newConstantInstruction =
        new ConstantInstruction(
                constantInstruction.opcode,
                constantAdder.addConstant(clazz, constantInstruction.constantIndex),
                constantInstruction.constant)
            .shrink();

    // Add the instruction.
    codeAttributeComposer.appendInstruction(offset, newConstantInstruction);
  }