View Javadoc

    1   /**
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package net.sourceforge.pmd.dfa;
    5
    6   import net.sourceforge.pmd.Rule;
    7   import net.sourceforge.pmd.RuleContext;
    8   import net.sourceforge.pmd.RuleViolation;
    9   import net.sourceforge.pmd.ast.SimpleNode;
    10
    11  /**
    12   * The RuleViolation is extended by the VariableName. The VariableName
    13   * is required for showing what variable produces the UR DD or DU anomaly.
    14   *
    15   * @author Sven Jacob
    16   *
    17   */
    18  public class DaaRuleViolation extends RuleViolation {
    19      private String variableName;
    20      private int beginLine;
    21      private int endLine;
    22      private String type;
    23
    24      public DaaRuleViolation(Rule rule, RuleContext ctx, SimpleNode node, String type, String msg, String var, int beginLine, int endLine) {
    25          super(rule, ctx, node, msg);
    26          this.variableName = var;
    27          this.beginLine = beginLine;
    28          this.endLine = endLine;
    29          this.type = type;
    30      }
    31
    32      public String getVariableName() {
    33          return variableName;
    34      }
    35
    36      public int getBeginLine() {
    37          return beginLine;
    38      }
    39
    40      public int getEndLine() {
    41          return endLine;
    42      }
    43
    44      public String getType() {
    45          return type;
    46      }
    47  }