Interface JTypeParameterSymbol
- All Superinterfaces:
AnnotableSymbol,JAccessibleElementSymbol,JElementSymbol,JTypeDeclSymbol
Represents the declaration of a type variable, ie a type parameter. Type variables are reference
types, but not class or interface types. They're also not declared with the same node. For those
reasons this type of references is distinct from
JClassSymbol.- Since:
- 7.0.0
-
Field Summary
Fields inherited from interface net.sourceforge.pmd.lang.java.symbols.JAccessibleElementSymbol
PRIMITIVE_PACKAGE -
Method Summary
Modifier and TypeMethodDescriptiondefault <R,P> R acceptVisitor(SymbolVisitor<R, P> visitor, P param) Dispatch to the appropriate visit method of the visitor and returns its result.Returns the upper bound of this type variable.Returns theJClassSymbolorJMethodSymbolwhich declared this type parameter.default @NonNull JClassSymbolReturns the class that directly encloses this declaration.default intReturns the modifiers of the element represented by this symbol, as decodable by the standardModifierAPI.default @NonNull StringReturns the name of the package this element is declared in.default ASTTypeParameterReturns the node that declares this symbol.Methods inherited from interface net.sourceforge.pmd.lang.java.symbols.AnnotableSymbol
getDeclaredAnnotation, getDeclaredAnnotations, isAnnotationPresentMethods inherited from interface net.sourceforge.pmd.lang.java.symbols.JAccessibleElementSymbol
isStaticMethods inherited from interface net.sourceforge.pmd.lang.java.symbols.JElementSymbol
equals, getTypeSystem, nameEqualsMethods inherited from interface net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol
getSimpleName, isInterface, isUnresolved
-
Method Details
-
getDeclaringSymbol
JTypeParameterOwnerSymbol getDeclaringSymbol()Returns theJClassSymbolorJMethodSymbolwhich declared this type parameter. -
getTypeMirror
JTypeVar getTypeMirror() -
computeUpperBound
JTypeMirror computeUpperBound()Returns the upper bound of this type variable. This may be an intersection type. If the variable is unbounded, returns Object. -
getPackageName
Description copied from interface:JAccessibleElementSymbolReturns the name of the package this element is declared in. This recurses into the enclosing elements if needed. If this is an array symbol, returns the package name of the element symbol. If this is a primitive type, returns "java.lang".This is consistent with Java 9's
getPackageName().- Specified by:
getPackageNamein interfaceJAccessibleElementSymbol
-
getModifiers
default int getModifiers()Description copied from interface:JAccessibleElementSymbolReturns the modifiers of the element represented by this symbol, as decodable by the standardModifierAPI.- Specified by:
getModifiersin interfaceJAccessibleElementSymbol
-
getEnclosingClass
Description copied from interface:JAccessibleElementSymbolReturns the class that directly encloses this declaration. This is equivalent toClass.getEnclosingClass(). Returns null if this is a top-level type declaration.This is necessarily an already resolved symbol, because 1. if it's obtained from reflection, then the enclosing class is available 2. if it's obtained from an AST, then the enclosing class is in the same source file so we can know about it
- Specified by:
getEnclosingClassin interfaceJAccessibleElementSymbol
-
acceptVisitor
Description copied from interface:JElementSymbolDispatch to the appropriate visit method of the visitor and returns its result.- Specified by:
acceptVisitorin interfaceJElementSymbol
-
tryGetNode
Description copied from interface:JElementSymbolReturns 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:
tryGetNodein interfaceJElementSymbol
-