示例#1
0
  /* skipSuper        1: this(), 0: super(), -1: both.
   */
  private int skipSuperConstructor0(int skipThis) throws BadBytecode {
    begin();
    ConstPool cp = codeAttr.getConstPool();
    String thisClassName = codeAttr.getDeclaringClass();
    int nested = 0;
    while (hasNext()) {
      int index = next();
      int c = byteAt(index);
      if (c == NEW) ++nested;
      else if (c == INVOKESPECIAL) {
        int mref = ByteArray.readU16bit(bytecode, index + 1);
        if (cp.getMethodrefName(mref).equals(MethodInfo.nameInit))
          if (--nested < 0) {
            if (skipThis < 0) return index;

            String cname = cp.getMethodrefClassName(mref);
            if (cname.equals(thisClassName) == (skipThis > 0)) return index;
            else break;
          }
      }
    }

    begin();
    return -1;
  }
示例#2
0
 protected CodeIterator(CodeAttribute ca) {
   codeAttr = ca;
   bytecode = ca.getCode();
   begin();
 }