Class JVariableSig
java.lang.Object
net.sourceforge.pmd.lang.java.types.JVariableSig
- Direct Known Subclasses:
JVariableSig.FieldSig
Represents a
value symbol
viewed in the context
of a particular program point (ie under a particular Substitution
).
The type given to a symbol is context-dependent. For example, when looking in the supertypes of the current class for a field, we have:
abstract class Sup<K> {
K field;
// In this scope the type of `field` is `K`, an abstract type variable
}
class Foo extends Sup<Integer> {
{
// in this scope, the type of `super.field` is `Integer`, not `K`,
// because we inherit `Sup` where `K` is substituted with `Integer`.
// `K` is not even in scope.
super.field = 2;
}
}
This interface plays a similar role to JMethodSig
. It is
the type of search results of a JSymbolTable
, see
JSymbolTable.variables()
.
-
Method Details
-
getDeclaringType
This is the substituted type. Eg in the example of the class javadoc, forsuper.field
, this would beSup<Integer>
. For local variables, this is always the generic type declaration of the enclosing type. -
getSymbol
Returns the symbol for this variable. -
getTypeMirror
Returns the type given to the symbol in the particular scope this signature is valid in. -
equals
-
hashCode
public int hashCode() -
toString
-