Exemple #1
0
  /**
   * Convenience method.
   *
   * <p>Add an empty constructor to this class that does nothing but calling super().
   *
   * @param access rights for constructor
   */
  public void addEmptyConstructor(int access_flags) {
    InstructionList il = new InstructionList();
    il.append(InstructionConstants.THIS); // Push `this'
    il.append(new INVOKESPECIAL(cp.addMethodref(super_class_name, "<init>", "()V")));
    il.append(InstructionConstants.RETURN);

    MethodGen mg =
        new MethodGen(access_flags, Type.VOID, Type.NO_ARGS, null, "<init>", class_name, il, cp);
    mg.setMaxStack(1);
    addMethod(mg.getMethod());
  }
 public int addInterfaceMethodref(MethodGen method) {
   return addInterfaceMethodref(method.getClassName(), method.getName(), method.getSignature());
 }
 public int lookupMethodref(MethodGen method) {
   return lookupMethodref(method.getClassName(), method.getName(), method.getSignature());
 }