public Object visit(ASTPrimaryPrefix node, Object data) {
    if (node.jjtGetNumChildren() == 0 || !(node.jjtGetChild(0) instanceof ASTName)) {
      return super.visit(node, data);
    }

    String image = ((ASTName) node.jjtGetChild(0)).getImage();
    if (image.startsWith("java.lang.")) {
      image = image.substring(10);
    }

    boolean checkBoolean =
        ((RuleContext) data)
                .getLanguageVersion()
                .compareTo(LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"))
            >= 0;

    if (PREFIX_SET.contains(image) || (checkBoolean && "Boolean.valueOf".equals(image))) {
      ASTPrimaryExpression parent = (ASTPrimaryExpression) node.jjtGetParent();
      if (parent.jjtGetNumChildren() >= 3) {
        Node n = parent.jjtGetChild(2);
        if (n instanceof ASTPrimarySuffix) {
          ASTPrimarySuffix suffix = (ASTPrimarySuffix) n;
          image = suffix.getImage();

          if (SUFFIX_SET.contains(image) || (checkBoolean && "booleanValue".equals(image))) {
            super.addViolation(data, node);
            return data;
          }
        }
      }
    }
    return super.visit(node, data);
  }
 /**
  * Simply return if the image start with keyword 'this' or 'super'.
  *
  * @return true, if keyword is used, false otherwise.
  */
 public boolean useThisOrSuper() {
   Node node = location.jjtGetParent();
   if (node instanceof ASTPrimaryExpression) {
     ASTPrimaryExpression primaryExpression = (ASTPrimaryExpression) node;
     ASTPrimaryPrefix prefix = (ASTPrimaryPrefix) primaryExpression.jjtGetChild(0);
     if (prefix != null) {
       return prefix.usesSuperModifier() || prefix.usesThisModifier();
     }
   }
   return image.startsWith(THIS_DOT) || image.startsWith(SUPER_DOT);
 }
  private boolean isStandAlonePostfix(Node primaryExpression) {
    if (!(primaryExpression instanceof ASTPostfixExpression)
        || !(primaryExpression.jjtGetParent() instanceof ASTStatementExpression)) {
      return false;
    }

    ASTPrimaryPrefix pf =
        (ASTPrimaryPrefix) ((ASTPrimaryExpression) primaryExpression.jjtGetChild(0)).jjtGetChild(0);
    if (pf.usesThisModifier()) {
      return true;
    }

    return thirdChildHasDottedName(primaryExpression);
  }
 private String getExpressionVarName(Node e) {
   String assignedVar = getFirstNameImage(e);
   if (assignedVar == null) {
     ASTPrimarySuffix suffix = e.getFirstDescendantOfType(ASTPrimarySuffix.class);
     if (suffix != null) {
       assignedVar = suffix.getImage();
       ASTPrimaryPrefix prefix = e.getFirstDescendantOfType(ASTPrimaryPrefix.class);
       if (prefix != null) {
         if (prefix.usesThisModifier()) {
           assignedVar = "this." + assignedVar;
         } else if (prefix.usesSuperModifier()) {
           assignedVar = "super." + assignedVar;
         }
       }
     }
   }
   return assignedVar;
 }