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

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 DontImportSun extends AbstractRule {
8 |  |
9 | 2 | public Object visit(ASTImportDeclaration node, Object data) {
10 | 2 | String img = ((SimpleNode) node.jjtGetChild(0)).getImage();
11 | 2 | if (img.startsWith("sun.") && !img.startsWith("sun.misc.Signal")) {
12 | 1 | addViolation(data, node);
13 |  | }
14 | 2 | return data;
15 |  | }
16 |  |
17 |  | }