@Override public void visit(MethodDeclaration methodDeclaration, Object arg) { if (methodDeclaration.getBody() != null) { for (Statement statement : methodDeclaration.getBody().getStmts()) { // check for starting a block statement if (statement instanceof SwitchStmt) { SwitchStmt switchStmt = (SwitchStmt) statement; for (SwitchEntryStmt switchEntryStmt : switchStmt.getEntries()) { reportExcessiveIndentation(switchEntryStmt.getStmts()); } } else if (statement instanceof IfStmt) { Statement currentIf = statement; do { reportExcessiveIndentation(((IfStmt) currentIf).getThenStmt()); currentIf = ((IfStmt) currentIf).getElseStmt(); } while (currentIf instanceof IfStmt); } else if (statement instanceof WhileStmt) { reportExcessiveIndentation(((WhileStmt) statement).getBody()); } else if (statement instanceof ForeachStmt) { reportExcessiveIndentation(((ForeachStmt) statement).getBody()); } else if (statement instanceof ForStmt) { reportExcessiveIndentation(((ForStmt) statement).getBody()); } else if (statement instanceof DoStmt) { reportExcessiveIndentation(((DoStmt) statement).getBody()); } } } super.visit(methodDeclaration, arg); }
@Override public void visit(final MethodDeclaration n, final A arg) { visitComment(n.getComment(), arg); visitAnnotations(n, arg); if (n.getTypeParameters() != null) { for (final TypeParameter t : n.getTypeParameters()) { t.accept(this, arg); } } n.getElementType().accept(this, arg); n.getNameExpr().accept(this, arg); if (n.getParameters() != null) { for (final Parameter p : n.getParameters()) { p.accept(this, arg); } } if (n.getThrows() != null) { for (final ReferenceType name : n.getThrows()) { name.accept(this, arg); } } if (n.getBody() != null) { n.getBody().accept(this, arg); } }
@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; }