Пример #1
0
 /**
  * Marks the start of an exception handler.
  *
  * @param start beginning of the exception handler's scope (inclusive).
  * @param end end of the exception handler's scope (exclusive).
  * @param exception internal name of the type of exceptions handled by the handler.
  */
 public void catchException(final Label start, final Label end, final Type exception) {
   if (exception == null) {
     mv.visitTryCatchBlock(start, end, mark(), null);
   } else {
     mv.visitTryCatchBlock(start, end, mark(), exception.getInternalName());
   }
 }
Пример #2
0
 /**
  * Generates an invoke method instruction.
  *
  * @param opcode the instruction's opcode.
  * @param type the class in which the method is defined.
  * @param method the method to be invoked.
  */
 private void invokeInsn(final int opcode, final Type type, final Method method) {
   String owner = type.getSort() == Type.ARRAY ? type.getDescriptor() : type.getInternalName();
   mv.visitMethodInsn(opcode, owner, method.getName(), method.getDescriptor());
 }
Пример #3
0
 /**
  * Generates a type dependent instruction.
  *
  * @param opcode the instruction's opcode.
  * @param type the instruction's operand.
  */
 private void typeInsn(final int opcode, final Type type) {
   mv.visitTypeInsn(opcode, type.getInternalName());
 }
Пример #4
0
 /**
  * Generates a get field or set field instruction.
  *
  * @param opcode the instruction's opcode.
  * @param ownerType the class in which the field is defined.
  * @param name the name of the field.
  * @param fieldType the type of the field.
  */
 private void fieldInsn(
     final int opcode, final Type ownerType, final String name, final Type fieldType) {
   mv.visitFieldInsn(opcode, ownerType.getInternalName(), name, fieldType.getDescriptor());
 }