Example #1
0
  public void outAMethodMember(AMethodMember node) {
    int modifier = 0;
    Type type;
    String name;
    List parameterList = null;
    List throwsClause = null;
    JimpleBody methodBody = null;

    if (node.getMethodBody() instanceof AFullMethodBody)
      methodBody = (JimpleBody) mProductions.removeLast();

    if (node.getThrowsClause() != null) throwsClause = (List) mProductions.removeLast();

    if (node.getParameterList() != null) {
      parameterList = (List) mProductions.removeLast();
    } else {
      parameterList = new ArrayList();
    }

    Object o = mProductions.removeLast();

    name = (String) o;
    type = (Type) mProductions.removeLast();
    modifier = processModifiers(node.getModifier());

    SootMethod method;

    if (throwsClause != null)
      method = new SootMethod(name, parameterList, type, modifier, throwsClause);
    else method = new SootMethod(name, parameterList, type, modifier);

    mSootClass.addMethod(method);

    if (method.isConcrete()) {
      methodBody.setMethod(method);
      method.setActiveBody(methodBody);

    } else if (node.getMethodBody() instanceof AFullMethodBody)
      throw new RuntimeException("Impossible: !concrete => ! instanceof");
  }