Class ClassScope
- java.lang.Object
-
- net.sourceforge.pmd.lang.symboltable.AbstractScope
-
- net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope
-
- net.sourceforge.pmd.lang.java.symboltable.ClassScope
-
- All Implemented Interfaces:
net.sourceforge.pmd.lang.symboltable.Scope
public class ClassScope extends AbstractJavaScope
This scope represents one Java class. It can have variable declarations, method declarations and inner class declarations.
-
-
Constructor Summary
Constructors Constructor Description ClassScope(String className, ClassNameDeclaration classNameDeclaration)
ClassScope(ClassNameDeclaration classNameDeclaration)
This is only for anonymous inner classes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<net.sourceforge.pmd.lang.symboltable.NameDeclaration>
addNameOccurrence(net.sourceforge.pmd.lang.symboltable.NameOccurrence occurrence)
protected Set<net.sourceforge.pmd.lang.symboltable.NameDeclaration>
findVariableHere(JavaNameOccurrence occurrence)
ClassNameDeclaration
getClassDeclaration()
Map<ClassNameDeclaration,List<net.sourceforge.pmd.lang.symboltable.NameOccurrence>>
getClassDeclarations()
String
getClassName()
Map<MethodNameDeclaration,List<net.sourceforge.pmd.lang.symboltable.NameOccurrence>>
getMethodDeclarations()
Map<VariableNameDeclaration,List<net.sourceforge.pmd.lang.symboltable.NameOccurrence>>
getVariableDeclarations()
Class<?>
resolveType(String name)
void
setIsEnum(boolean isEnum)
String
toString()
-
Methods inherited from class net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope
addDeclaration, checkForDuplicatedNameDeclaration, contains, glomNames
-
-
-
-
Constructor Detail
-
ClassScope
public ClassScope(String className, ClassNameDeclaration classNameDeclaration)
-
ClassScope
public ClassScope(ClassNameDeclaration classNameDeclaration)
This is only for anonymous inner classes.FIXME - should have name like Foo$1, not Anonymous$1 to get this working right, the parent scope needs to be passed in when instantiating a ClassScope
- Parameters:
classNameDeclaration
- The declaration of this class, as known to the parent scope.
-
-
Method Detail
-
getClassDeclaration
public ClassNameDeclaration getClassDeclaration()
-
setIsEnum
public void setIsEnum(boolean isEnum)
-
getClassDeclarations
public Map<ClassNameDeclaration,List<net.sourceforge.pmd.lang.symboltable.NameOccurrence>> getClassDeclarations()
-
getMethodDeclarations
public Map<MethodNameDeclaration,List<net.sourceforge.pmd.lang.symboltable.NameOccurrence>> getMethodDeclarations()
-
getVariableDeclarations
public Map<VariableNameDeclaration,List<net.sourceforge.pmd.lang.symboltable.NameOccurrence>> getVariableDeclarations()
-
addNameOccurrence
public Set<net.sourceforge.pmd.lang.symboltable.NameDeclaration> addNameOccurrence(net.sourceforge.pmd.lang.symboltable.NameOccurrence occurrence)
- Specified by:
addNameOccurrence
in interfacenet.sourceforge.pmd.lang.symboltable.Scope
- Overrides:
addNameOccurrence
in classnet.sourceforge.pmd.lang.symboltable.AbstractScope
-
getClassName
public String getClassName()
-
findVariableHere
protected Set<net.sourceforge.pmd.lang.symboltable.NameDeclaration> findVariableHere(JavaNameOccurrence occurrence)
- Specified by:
findVariableHere
in classAbstractJavaScope
-
-