Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |
file stats: | LOC: | 22 |  | Methods: | 1
| NCLOC: | 18 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
MethodWithSameNameAsEnclosingClass.java | 100% | 100% | 100% | 100% |

1 |  | package net.sourceforge.pmd.rules;
2 |  |
3 |  | import net.sourceforge.pmd.AbstractRule;
4 |  | import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
5 |  | import net.sourceforge.pmd.ast.ASTMethodDeclarator;
6 |  |
7 |  | import java.util.Iterator;
8 |  | import java.util.List;
9 |  |
10 |  | public class MethodWithSameNameAsEnclosingClass extends AbstractRule {
11 |  |
12 | 3 | public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
13 | 3 | List methods = node.findChildrenOfType(ASTMethodDeclarator.class);
14 | 3 | for (Iterator i = methods.iterator(); i.hasNext();) {
15 | 2 | ASTMethodDeclarator m = (ASTMethodDeclarator) i.next();
16 | 2 | if (m.getImage().equals(node.getImage())) {
17 | 1 | addViolation(data, m);
18 |  | }
19 |  | }
20 | 3 | return super.visit(node, data);
21 |  | }
22 |  | }