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