View Javadoc

    1   package net.sourceforge.pmd.lang.java.rule.controversial;
    2
    3   import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration;
    4   import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
    5
    6   public class DontImportSunRule extends AbstractJavaRule {
    7
    8       public Object visit(ASTImportDeclaration node, Object data) {
    9           String img = node.jjtGetChild(0).getImage();
    10          if (img.startsWith("sun.") && !img.startsWith("sun.misc.Signal")) {
    11              addViolation(data, node);
    12          }
    13          return data;
    14      }
    15
    16  }