View Javadoc

    1   package net.sourceforge.pmd.symboltable;
    2
    3   import java.util.HashMap;
    4   import java.util.Map;
    5
    6   /***
    7    * Implementation of Scope for source types that are simpler than java sources.
    8    * It implements the methods only when necessary not to break at runtime
    9    * when Violations are handled.
    10   *
    11   * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
    12   */
    13  public class DummyScope implements Scope {
    14      private Map emptyMap = new HashMap();
    15
    16      private Scope parent;
    17
    18      public Map getVariableDeclarations() {
    19          return emptyMap;
    20      }
    21
    22      public Map getClassDeclarations() {
    23          return emptyMap;
    24      }
    25
    26      public void addDeclaration(ClassNameDeclaration decl) {
    27      }
    28
    29      public void addDeclaration(VariableNameDeclaration decl) {
    30      }
    31
    32      public void addDeclaration(MethodNameDeclaration decl) {
    33      }
    34
    35      public boolean contains(NameOccurrence occ) {
    36          return false;
    37      }
    38
    39      public NameDeclaration addVariableNameOccurrence(NameOccurrence occ) {
    40          return null;
    41      }
    42
    43      public void setParent(Scope parent) {
    44          this.parent = parent;
    45      }
    46
    47      public Scope getParent() {
    48          return parent;
    49      }
    50
    51      public ClassScope getEnclosingClassScope() {
    52          return new ClassScope();
    53      }
    54
    55      public SourceFileScope getEnclosingSourceFileScope() {
    56          return new SourceFileScope();
    57      }
    58
    59      public MethodScope getEnclosingMethodScope() {
    60          return null;
    61      }
    62
    63  }