コード例 #1
0
ファイル: CodeAttribute.java プロジェクト: JimoLucy/javassist
  /**
   * Constructs a copy of <code>Code_attribute</code>. Specified class names are replaced during the
   * copy.
   *
   * @param cp constant pool table.
   * @param src source Code attribute.
   * @param classnames pairs of replaced and substituted class names.
   */
  private CodeAttribute(ConstPool cp, CodeAttribute src, Map classnames) throws BadBytecode {
    super(cp, tag);

    maxStack = src.getMaxStack();
    maxLocals = src.getMaxLocals();
    exceptions = src.getExceptionTable().copy(cp, classnames);
    attributes = new ArrayList();
    List src_attr = src.getAttributes();
    int num = src_attr.size();
    for (int i = 0; i < num; ++i) {
      AttributeInfo ai = (AttributeInfo) src_attr.get(i);
      attributes.add(ai.copy(cp, classnames));
    }

    info = src.copyCode(cp, classnames, exceptions, this);
  }
コード例 #2
0
ファイル: CodeIterator.java プロジェクト: struberg/javassist
 /**
  * Copies and appends the entries in the given exception table at the end of the exception table
  * in the code attribute edited by this object.
  *
  * @param offset the value added to the code positions included in the entries.
  */
 public void append(ExceptionTable et, int offset) {
   ExceptionTable table = codeAttr.getExceptionTable();
   table.add(table.size(), et, offset);
 }
コード例 #3
0
ファイル: CodeIterator.java プロジェクト: struberg/javassist
 /**
  * Copies and inserts the entries in the given exception table at the beginning of the exception
  * table in the code attribute edited by this object.
  *
  * @param offset the value added to the code positions included in the entries.
  */
 public void insert(ExceptionTable et, int offset) {
   codeAttr.getExceptionTable().add(0, et, offset);
 }