@Override
  public Boolean visit(final MethodDeclaration n1, final Node arg) {
    final MethodDeclaration n2 = (MethodDeclaration) arg;

    // javadoc are checked at CompilationUnit

    if (n1.getModifiers() != n2.getModifiers()) {
      return Boolean.FALSE;
    }

    if (n1.getArrayCount() != n2.getArrayCount()) {
      return Boolean.FALSE;
    }

    if (!objEquals(n1.getName(), n2.getName())) {
      return Boolean.FALSE;
    }

    if (!nodeEquals(n1.getType(), n2.getType())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
      return Boolean.FALSE;
    }

    if (!nodeEquals(n1.getBody(), n2.getBody())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
      return Boolean.FALSE;
    }
    if (n1.isDefault() != n2.isDefault()) {
      return Boolean.FALSE;
    }
    return Boolean.TRUE;
  }
  private JavaMethod createMethod(MethodDeclaration method) {
    String className = classStack.peek().getName();
    String name = method.getName();
    boolean isStatic = ModifierSet.hasModifier(method.getModifiers(), ModifierSet.STATIC);
    String returnType = method.getType().toString();
    ArrayList<Argument> arguments = new ArrayList<Argument>();

    if (method.getParameters() != null) {
      for (Parameter parameter : method.getParameters()) {
        arguments.add(new Argument(getArgumentType(parameter), parameter.getId().getName()));
      }
    }

    return new JavaMethod(
        className,
        name,
        isStatic,
        returnType,
        null,
        arguments,
        method.getBeginLine(),
        method.getEndLine());
  }
Beispiel #3
0
 @Override
 public AccessFlags getAccessFlags() {
   return new AccessFlags(declaration.getModifiers());
 }