示例#1
0
  @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;
  }
 // This generates all the test methods of the class, given a starting node
 private static List<BodyDeclaration> generateTestMethods(RoundTripPathTreeNode node) {
   final List<BlockStmt> bodies = generateTestBodies(node);
   final List<BodyDeclaration> methods = new ArrayList<BodyDeclaration>();
   int i = 0;
   for (BlockStmt body : bodies) {
     final MethodDeclaration method =
         new MethodDeclaration(
             ModifierSet.PUBLIC,
             new VoidType(),
             "conformanceTest" + i++,
             Collections.<Parameter>emptyList());
     method.getAnnotations().add(new MarkerAnnotationExpr(new NameExpr("Test")));
     method.setBody(body);
     methods.add(method);
   }
   return methods;
 }
示例#3
0
 @Override
 public List<Annotation> getAnnotations() {
   return SourceInfo.this.getAnnotationsInternal(declaration.getAnnotations());
 }