Class AstLocalVarSym
- java.lang.Object
-
- net.sourceforge.pmd.lang.java.symbols.internal.ast.AstLocalVarSym
-
- All Implemented Interfaces:
AnnotableSymbol
,JElementSymbol
,JLocalVariableSymbol
,JVariableSymbol
public final class AstLocalVarSym extends Object implements JLocalVariableSymbol
- Author:
- Clément Fournier
-
-
Method Summary
All Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description boolean
equals(Object o)
Two symbols representing the same program element should be equal.org.pcollections.PSet<SymbolicValue.SymAnnot>
getDeclaredAnnotations()
Return the valid symbolic annotations defined on this symbol.String
getSimpleName()
Gets the name with which this declaration may be referred to, eg the name of the method, or the simple name of the class.JTypeMirror
getTypeMirror(Substitution subst)
Returns the type of this value, under the given substitution.TypeSystem
getTypeSystem()
Returns the type system that created this symbol.int
hashCode()
boolean
isFinal()
Returns true if this declaration is declared final.String
toString()
default @Nullable N
tryGetNode()
Returns the node that declares this symbol.@NonNull T
tryGetNode()
Returns the node that declares this symbol.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.java.symbols.AnnotableSymbol
getDeclaredAnnotation, getDeclaredAnnotations, isAnnotationPresent
-
Methods inherited from interface net.sourceforge.pmd.lang.java.symbols.JElementSymbol
getSimpleName, getTypeSystem, isUnresolved, nameEquals
-
Methods inherited from interface net.sourceforge.pmd.lang.java.symbols.JLocalVariableSymbol
acceptVisitor
-
Methods inherited from interface net.sourceforge.pmd.lang.java.symbols.JVariableSymbol
isField, isFinal
-
-
-
-
Field Detail
-
node
protected final T extends SymbolDeclaratorNode node
-
factory
protected final net.sourceforge.pmd.lang.java.symbols.internal.ast.AstSymFactory factory
-
-
Method Detail
-
equals
public boolean equals(Object o)
Description copied from interface:JElementSymbol
Two symbols representing the same program element should be equal. So eg twoJClassSymbol
, even if their implementation class is different, should compare publicly observable properties (their binary name is enough).#hashCode()
must of course be consistent with this contract.Symbols should only be compared using this method, never with
==
, because their unicity is not guaranteed.- Specified by:
equals
in interfaceJElementSymbol
- Parameters:
o
- Comparand- Returns:
- True if the other is a symbol for the same program element
-
hashCode
public int hashCode()
-
getTypeMirror
public JTypeMirror getTypeMirror(Substitution subst)
Description copied from interface:JVariableSymbol
Returns the type of this value, under the given substitution.- Specified by:
getTypeMirror
in interfaceJVariableSymbol
-
tryGetNode
public default @Nullable N tryGetNode()
Description copied from interface:JElementSymbol
Returns the node that declares this symbol. Eg forJMethodSymbol
, it's anASTMethodDeclaration
. Will only return non-null if the symbol is declared in the file currently being analysed.- Specified by:
tryGetNode
in interfaceJElementSymbol
-
isFinal
public boolean isFinal()
Description copied from interface:JVariableSymbol
Returns true if this declaration is declared final. This takes implicit modifiers into account.- Specified by:
isFinal
in interfaceJVariableSymbol
-
getSimpleName
public String getSimpleName()
Description copied from interface:JElementSymbol
Gets the name with which this declaration may be referred to, eg the name of the method, or the simple name of the class.- Specified by:
getSimpleName
in interfaceJElementSymbol
- Returns:
- the name
-
getDeclaredAnnotations
public org.pcollections.PSet<SymbolicValue.SymAnnot> getDeclaredAnnotations()
Description copied from interface:AnnotableSymbol
Return the valid symbolic annotations defined on this symbol. Annotations that could not be converted, eg because they are written with invalid code, are discarded, so this might not match the annotations on a node one to one.- Specified by:
getDeclaredAnnotations
in interfaceAnnotableSymbol
-
getTypeSystem
public TypeSystem getTypeSystem()
Description copied from interface:JElementSymbol
Returns the type system that created this symbol. The symbol uses this instance to create new types, for example to reflect its superclass.- Specified by:
getTypeSystem
in interfaceJElementSymbol
-
tryGetNode
public @NonNull T tryGetNode()
Description copied from interface:JElementSymbol
Returns the node that declares this symbol. Eg forJMethodSymbol
, it's anASTMethodDeclaration
. Will only return non-null if the symbol is declared in the file currently being analysed.- Specified by:
tryGetNode
in interfaceJElementSymbol
-
-