Example #1
0
  /** Creates a new method info. */
  protected MethodInfo(Method m, ClassInfo c) {
    name = m.getName();
    signature = m.getSignature();
    ci = c;

    code = loadCode(m);
    exceptions = loadExceptions(m);
    thrownExceptionClassNames = loadThrownExceptionClassNames(m);
    lineNumbers = loadLineNumbers(m);
    maxLocals = getMaxLocals(m);
    maxStack = getMaxStack(m);
    localVariableNames = loadLocalVariableNames(m);
    localVariableTypes = loadLocalVariableTypes(m);

    modifiers = m.getModifiers();

    // clinits are automatically synchronized on the class object,
    // and they don't let unhandled exceptions through
    if (name.equals("<clinit>")) {
      modifiers |= Modifier.SYNCHRONIZED;
      attrs |= IS_CLINIT | FIREWALL;
    }

    if (name.equals("<init>")) {
      attrs |= IS_INIT;
    }

    if (c.isInterface()) { // all interface methods are public
      modifiers |= Modifier.PUBLIC;
    }

    // since that's used to store the method in the ClassInfo, and to
    // identify it in tne InvokeInstruction, we can set it here
    uniqueName = getUniqueName(name, signature);

    globalId = mthTable.size();
    mthTable.add(this);

    loadAnnotations(m.getAnnotationEntries());
    loadParameterAnnotations(m);
  }