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:
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<NameDeclaration>
addNameOccurrence(NameOccurrence occurrence)
protected Set<NameDeclaration>
findVariableHere(JavaNameOccurrence occurrence)
ClassNameDeclaration
getClassDeclaration()
Map<ClassNameDeclaration,List<NameOccurrence>>
getClassDeclarations()
String
getClassName()
Map<MethodNameDeclaration,List<NameOccurrence>>
getMethodDeclarations()
Map<VariableNameDeclaration,List<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
-
Methods inherited from class net.sourceforge.pmd.lang.symboltable.AbstractScope
getDeclarations, getDeclarations, getEnclosingScope, getParent, setParent
-
-
-
-
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<NameOccurrence>> getClassDeclarations()
-
getMethodDeclarations
public Map<MethodNameDeclaration,List<NameOccurrence>> getMethodDeclarations()
-
getVariableDeclarations
public Map<VariableNameDeclaration,List<NameOccurrence>> getVariableDeclarations()
-
addNameOccurrence
public Set<NameDeclaration> addNameOccurrence(NameOccurrence occurrence)
- Specified by:
addNameOccurrence
in interfaceScope
- Overrides:
addNameOccurrence
in classAbstractScope
-
getClassName
public String getClassName()
-
findVariableHere
protected Set<NameDeclaration> findVariableHere(JavaNameOccurrence occurrence)
- Specified by:
findVariableHere
in classAbstractJavaScope
-
-