Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 28 |  | Methods: | 1
| NCLOC: | 23 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
DontImportJavaLang.java | 83.3% | 100% | 100% | 93.3% |

1 |  | package net.sourceforge.pmd.rules.imports;
2 |  |
3 |  | import net.sourceforge.pmd.AbstractRule;
4 |  | import net.sourceforge.pmd.ast.ASTImportDeclaration;
5 |  | import net.sourceforge.pmd.ast.SimpleNode;
6 |  |
7 |  | public class DontImportJavaLang extends AbstractRule {
8 |  |
9 | 8 | public Object visit(ASTImportDeclaration node, Object data) {
10 | 8 | if (node.isStatic()) {
11 | 1 | return data;
12 |  | }
13 | 7 | String img = ((SimpleNode) node.jjtGetChild(0)).getImage();
14 | 7 | if (img.startsWith("java.lang")) {
15 | 7 | if (img.startsWith("java.lang.ref")
16 |  | || img.startsWith("java.lang.reflect")
17 |  | || img.startsWith("java.lang.annotation")
18 |  | || img.startsWith("java.lang.instrument")
19 |  | || img.startsWith("java.lang.management")) {
20 | 5 | return data;
21 |  | }
22 |  |
23 | 2 | addViolation(data, node);
24 |  | }
25 | 2 | return data;
26 |  | }
27 |  |
28 |  | }