Interface TypeVariableSource
- All Superinterfaces:
ModifierReviewable, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement
- All Known Subinterfaces:
InstrumentedType, InstrumentedType.WithFlexibleName, MethodDescription, MethodDescription.InDefinedShape, MethodDescription.InGenericShape, TypeDescription
- All Known Implementing Classes:
Implementation.Context.Default.AbstractPropertyAccessorMethod, Implementation.Context.Default.AccessorMethod, Implementation.Context.Default.FieldGetter, Implementation.Context.Default.FieldSetter, InstrumentedType.Default, InstrumentedType.Frozen, JavaType.LatentTypeWithSimpleName, MethodDescription.AbstractBase, MethodDescription.ForLoadedConstructor, MethodDescription.ForLoadedMethod, MethodDescription.InDefinedShape.AbstractBase, MethodDescription.InDefinedShape.AbstractBase.ForLoadedExecutable, MethodDescription.Latent, MethodDescription.Latent.TypeInitializer, MethodDescription.TypeSubstituting, MethodRebaseResolver.Resolution.ForRebasedConstructor.RebasedConstructor, MethodRebaseResolver.Resolution.ForRebasedMethod.RebasedMethod, Transformer.ForMethod.TransformedMethod, TypeDescription.AbstractBase, TypeDescription.AbstractBase.OfSimpleType, TypeDescription.AbstractBase.OfSimpleType.WithDelegation, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.Latent, TypeDescription.SuperTypeLoading, TypePool.Default.LazyTypeDescription, TypePool.Default.LazyTypeDescription.LazyMethodDescription, TypePool.Default.WithLazyResolution.ExtendedLazyTypeDescription, TypePool.Default.WithLazyResolution.LazyTypeDescription, TypePool.LazyFacade.LazyTypeDescription, TypeVariableSource.AbstractBase, TypeWriter.MethodPool.Record.AccessBridgeWrapper.AccessorBridge, TypeWriter.MethodPool.Record.AccessBridgeWrapper.BridgeTarget, TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge.VisibilityBridge
A type variable source represents a code element that can declare type variables.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classAn abstract base implementation of a type variable source.static interfaceA visitor that can be applied to a type variable source.Nested classes/interfaces inherited from interface ModifierReviewable
ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForModuleDescription, ModifierReviewable.ForModuleRequirement, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration, ModifierReviewable.OfMandatable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeVariableSourceIndicates that a type variable source is undefined.Fields inherited from interface ModifierReviewable
EMPTY_MASK -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(TypeVariableSource.Visitor<T> visitor) Applies a visitor on this type variable source.findExpectedVariable(String symbol) Finds a particular variable with the given name in the closes type variable source that is visible from this instance.findVariable(String symbol) Finds a particular variable with the given name in the closes type variable source that is visible from this instance.Returns the enclosing source of type variables that are valid in the scope of this type variable source.Returns the type variables that are declared by this element.booleanChecks if this type variable source has a generic declaration.booleanReturnstrueif type variables declared by this type variable source allow dynamic type inference.Methods inherited from interface ModifierReviewable
getModifiers, getSyntheticState, isFinal, isSyntheticMethods inherited from interface ModifierReviewable.OfAbstraction
isAbstractMethods inherited from interface ModifierReviewable.OfByteCodeElement
getOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
-
Field Details
-
UNDEFINED
Indicates that a type variable source is undefined.
-
-
Method Details
-
getTypeVariables
TypeList.Generic getTypeVariables()Returns the type variables that are declared by this element.- Returns:
- The type variables that are declared by this element.
-
getEnclosingSource
Returns the enclosing source of type variables that are valid in the scope of this type variable source.- Returns:
- The enclosing source or
nullif no such source exists.
-
isInferrable
boolean isInferrable()Returnstrueif type variables declared by this type variable source allow dynamic type inference.- Returns:
trueif type variables declared by this type variable source allow dynamic type inference.
-
findVariable
Finds a particular variable with the given name in the closes type variable source that is visible from this instance.- Parameters:
symbol- The symbolic name of the type variable.- Returns:
- The type variable or
nullif it was not found.
-
findExpectedVariable
Finds a particular variable with the given name in the closes type variable source that is visible from this instance. If the variable is not found, an exception is thrown.- Parameters:
symbol- The symbolic name of the type variable.- Returns:
- The type variable.
-
accept
Applies a visitor on this type variable source.- Type Parameters:
T- The visitor's return type.- Parameters:
visitor- The visitor to apply.- Returns:
- The visitor's return value.
-
isGenerified
boolean isGenerified()Checks if this type variable source has a generic declaration. This means:- A type declares type variables or is an inner class of a type with a generic declaration.
- A method declares at least one type variable.
- A type is a class that is declared within a method with a generic declaration.
- Returns:
trueif this type code element has a generic declaration.
-