Class BoundedReferenceType
java.lang.Object
org.aspectj.weaver.UnresolvedType
org.aspectj.weaver.ResolvedType
org.aspectj.weaver.ReferenceType
org.aspectj.weaver.BoundedReferenceType
- All Implemented Interfaces:
AnnotatedElement, Traceable, TypeVariableDeclaringElement
A BoundedReferenceType is the result of a generics wildcard expression ? extends String, ? super Foo etc..
The "signature" for a bounded reference type follows the generic signature specification in section 4.4 of JVM spec: *,+,- plus
signature strings.
The bound may be a type variable (e.g. ? super T)
- Author:
- Adrian Colyer, Andy Clement
-
Nested Class Summary
Nested classes/interfaces inherited from class UnresolvedType
UnresolvedType.TypeKind -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReferenceType[]static final intintstatic final intstatic final intFields inherited from class ReferenceType
EMPTY_ARRAYFields inherited from class ResolvedType
bits, crosscuttingMembers, EMPTY_RESOLVED_TYPE_ARRAY, interTypeMungers, MISSING, NONE, PARAMETERIZED_TYPE_IDENTIFIER, temporaryAnnotationTypes, validBoxing, worldModifier and TypeFieldDescriptionprotected intstatic final ResolvedType[]protected List<ConcreteTypeMunger> static final org.aspectj.weaver.ResolvedType.Missingstatic final ResolvedType[]static final Stringprotected WorldFields inherited from class UnresolvedType
AJC_PRIVILEGED, ANNOTATION, ARRAY_WITH_JUST_OBJECT, AT_INHERITED, AT_RETENTION, AT_TARGET, BOOLEAN, BYTE, CHAR, CLONEABLE, DOUBLE, ENUM, ERROR, FLOAT, INT, JAVA_LANG_ANNOTATION, JAVA_LANG_CLASS_ARRAY, JAVA_LANG_REFLECT_CONSTRUCTOR, JAVA_LANG_REFLECT_FIELD, JAVA_LANG_REFLECT_METHOD, JL_CLASS, JL_EXCEPTION, JL_STRING, JOINPOINT_ENCLOSINGSTATICPART, JOINPOINT_STATICPART, LONG, MISSING_NAME, OBJECT, OBJECTARRAY, PROCEEDING_JOINPOINT, RUNTIME_EXCEPTION, SERIALIZABLE, SHORT, signature, signatureErasure, SOMETHING, SUPPRESS_AJ_WARNINGS, THROWABLE, typeKind, typeParameters, typeVariables, VOIDModifier and TypeFieldDescriptionstatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedType[]static final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final Stringstatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypeprotected Stringprotected StringThe erasure of the signature.static final UnresolvedTypestatic final UnresolvedTypestatic final UnresolvedTypeprotected UnresolvedType.TypeKindprotected UnresolvedType[]Iff isParameterized(), then these are the type parametersprotected TypeVariable[]Iff isGeneric(), then these are the type variables declared on the type Iff isParameterized(), then these are the type variables bound as parameters in the typestatic final UnresolvedType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBoundedReferenceType(String signature, String erasedSignature, World world) only for use when resolving GenericsWildcardTypeX or a TypeVariableReferenceTypeBoundedReferenceType(ReferenceType aBound, boolean isExtends, World world) BoundedReferenceType(ReferenceType aBound, boolean isExtends, World world, ReferenceType[] additionalInterfaces) BoundedReferenceType(World world) Constructs the BoundedReferenceType representing an unbounded wildcard '?'. -
Method Summary
Modifier and TypeMethodDescriptionbooleanalwaysMatches(ResolvedType aCandidateType) booleancanBeCoercedTo(ResolvedType aCandidateType) Find out from the generic signature the true signature of any interfaces I implement.booleanbooleanbooleanbooleanisSuper()booleanparameterize(Map<String, UnresolvedType> typeBindings) Iff I am a parameterized type, and any of my parameters are type variable references (or nested parameterized types), return a version with those type parameters replaced in accordance with the passed bindings.Methods inherited from class ReferenceType
addAnnotation, addParent, canAnnotationTargetType, checkDuplicates, demoteToSimpleType, doesNotExposeShadowMungers, ensureConsistent, findDerivativeType, fromTypeX, getAnnotationOfType, getAnnotations, getAnnotationTargetKinds, getAnnotationTypes, getCompilerVersion, getDeclaredFields, getDeclaredGenericSignature, getDeclaredMethods, getDeclaredPointcuts, getDeclares, getDelegate, getEndPos, getGenericSignature, getGenericType, getModifiers, getNameAsIdentifier, getOuterClass, getPerClause, getPrivilegedAccesses, getRetentionPolicy, getSourceContext, getSourceLocation, getStartPos, getSuperclass, getTypeMungers, getTypeVariables, getWeaverState, hasAnnotation, hasAnnotations, hasNewInterfaces, isAnnotation, isAnnotationStyleAspect, isAnnotationWithRuntimeRetention, isAnonymous, isAspect, isAssignableFrom, isAssignableFrom, isClass, isCoerceableFrom, isEnum, isExposedToWeaver, isGenericType, isNested, setDelegate, setEndPos, setGenericType, setStartPosModifier and TypeMethodDescriptionvoidaddAnnotation(AnnotationAJ annotationX) voidaddParent(ResolvedType newParent) booleanNote: Only overridden by ReferenceType subtypevoidcheckDuplicates(ReferenceType newRt) voidbooleanvoidUndo any temporary modifications to the type (for example it may be holding annotations temporarily whilst some matching is occurring - These annotations will be added properly during weaving but sometimes for type completion they need to be held here for a while).findDerivativeType(ResolvedType[] typeParameters) Look for a derivative type with the specified type parameters.static ReferenceTypefromTypeX(UnresolvedType tx, World world) getAnnotationOfType(UnresolvedType ofType) Note: Only overridden by ReferenceType subtypeintreturn the weaver version used to build this type - defaults to the most recent version unless discovered otherwise.intOverridden by ReferenceType to return a sensible answer for parameterized and raw types.intintbooleanhasAnnotation(UnresolvedType ofType) booleanbooleanbooleanNote: Only overridden by Name subtype.booleanbooleanNote: Only overridden by Name subtype.booleanbooleanisAspect()booleanisAssignableFrom(ResolvedType other) Determines if the variables of this type could be assigned values of another type without casting.booleanisAssignableFrom(ResolvedType other, boolean allowMissing) booleanisClass()booleanDetermines if values of another type could possibly be cast to this type.booleanisEnum()Note: Only overridden by Name subtype.booleanbooleanbooleanisNested()voidsetDelegate(ReferenceTypeDelegate delegate) voidsetEndPos(int endPos) voidvoidsetStartPos(int startPos) Methods inherited from class ResolvedType
addInterTypeMunger, ajMembersNeedParameterization, canBeSeenBy, checkInterTypeMungers, checkLegalOverride, clearInterTypeMungers, collectCrosscuttingMembers, collectDeclares, collectInterTypeMungers, conflictingSignature, conflictingSignature, discoverActualOccurrenceOfTypeInHierarchy, equals, fillInAnyTypeParameters, findPointcut, getAjMemberParameterizationMap, getBinaryPath, getDeclaredAdvice, getDeclaredJavaFields, getDeclaredJavaMethods, getDeclaredShadowMungers, getDeclaringType, getDirectSupertypes, getExposedPointcuts, getFields, getHierarchy, getHierarchy, getHierarchyWithoutIterator, getInterTypeMungers, getInterTypeMungersIncludingSupers, getInterTypeParentMungers, getInterTypeParentMungersIncludingSupers, getMemberParameterizationMap, getMethods, getMethodsIncludingIntertypeDeclarations, getMethodsWithoutIterator, getPointcuts, getRawType, getResolvedComponentType, getResolvedTypeParameters, getSize, getTopmostImplementor, getWorld, isAbstract, isCacheable, isCheckedException, isConvertableFrom, isException, isFinal, isGroovyObject, isInheritedAnnotation, isInterface, isMissing, isMissing, isMoreVisible, isParameterizedWithTypeVariable, isPrimitiveArray, isPrivilegedAspect, isSynthetic, isTopmostImplementor, isTypeHierarchyComplete, isVisible, lookupDirectlyDeclaredMemberNoSupers, lookupField, lookupMemberIncludingITDsOnInterfaces, lookupMemberNoSupers, lookupMemberWithSupersAndITDs, lookupMethod, lookupMethodInITDs, lookupResolvedMember, lookupSyntheticMember, makeArray, matches, needsNoConversionFrom, parameterizedWith, setBinaryPath, tagAsTypeHierarchyCompleteModifier and TypeMethodDescriptionvoidaddInterTypeMunger(ConcreteTypeMunger munger, boolean isDuringCompilation) Add an intertype munger to this type.protected booleanbooleancanBeSeenBy(ResolvedType from) voidCheck: 1) That we don't have any abstract type mungers unless this type is abstract.booleancheckLegalOverride(ResolvedMember parent, ResolvedMember child, int transformerPosition, ResolvedType aspectType) voidcollectCrosscuttingMembers(boolean shouldConcretizeIfNeeded) collectDeclares(boolean includeAdviceLike) protected voidcollectInterTypeMungers(List<ConcreteTypeMunger> collector) static booleanconflictingSignature(Member m1, Member m2) static booleanconflictingSignature(Member m1, Member m2, boolean v2itds) Do the two members conflict? Due to the change in 1.7.1, field itds on interfaces now act like 'default' fields - so types implementing those fields get the field if they don't have it already, otherwise they keep what they have.Look up the actual occurence of a particular type in the hierarchy for 'this' type.booleanEquality is checked based on the underlying signature.Called for all type mungers but only does something if they share type variables with a generic type which they target.findPointcut(String name) protected Map<String, UnresolvedType> Returns the path to the jar or class file from which this binary aspect came or null if not a binary aspectReturns a ResolvedType object representing the declaring type of this type, or null if this type does not represent a non-package-level-type.final Iterator<ResolvedType> Returns an iterator through ResolvedType objects representing all the direct supertypes of this type.returns an iterator through all of the fields of this type, in order for checking from JVM spec 2ed 5.4.3.2.Return an iterator over the types in this types hierarchy - starting with this type first, then all superclasses up to Object and then all interfaces (starting with those 'nearest' this type).getHierarchy(boolean wantGenerics, boolean wantDeclaredParents) Return an iterator over the types in this types hierarchy - starting with this type first, then all superclasses up to Object and then all interfaces (starting with those 'nearest' this type).getHierarchyWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) Return a list of the types in the hierarchy of this type, starting with this type.??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my superprotected Map<String, UnresolvedType> getMethods(boolean wantGenerics, boolean wantDeclaredParents) returns an iterator through all of the methods of this type, in order for checking from JVM spec 2ed 5.4.3.3.getMethodsIncludingIntertypeDeclarations(boolean wantGenerics, boolean wantDeclaredParents) getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) Return a list of methods, first those declared on this class, then those declared on the superclass (recurse) and then those declared on the superinterfaces.returns an iterator through all of the pointcuts of this type, in order for checking from JVM spec 2ed 5.4.3.2 (as for fields).intgetSize()This is the size of this type as used in JVM.getTopmostImplementor(ResolvedType interfaceType) getWorld()final booleanbooleanbooleanfinal booleanisConvertableFrom(ResolvedType other) Determines if variables of this type could be assigned values of another with lots of help.booleanfinal booleanisFinal()booleanbooleanFor an annotation type, this will return if it is marked with @Inheritedfinal booleanbooleanstatic booleanisMissing(UnresolvedType unresolved) static booleanisMoreVisible(int m1, int m2) booleanreturn true if the parameterization of this type includes a member type variable.booleanbooleanbooleanbooleanisTopmostImplementor(ResolvedType interfaceType) booleanstatic booleanisVisible(int modifiers, ResolvedType targetType, ResolvedType fromType) as lookupMemberNoSupers, but does not include ITDslookupField(Member field) described in JVM spec 2ed 5.4.3.2This lookup has specialized behaviour - a null result tells the EclipseTypeMunger that it should make a default implementation of a method on this type.lookupMemberNoSupers(Member member) Look up a member, takes into account any ITDs on this type.lookupMemberWithSupersAndITDs(Member member) described in JVM spec 2ed 5.4.3.3.lookupMethodInITDs(Member member) lookupResolvedMember(ResolvedMember aMember, boolean allowMissing, boolean eraseGenerics) Looks for the first member in the hierarchy matching aMember.lookupSyntheticMember(Member member) static ResolvedTypemakeArray(ResolvedType type, int dim) static booleanbooleanparameterizedWith(UnresolvedType[] typeParameters) voidsetBinaryPath(String binaryPath) voidMethods inherited from class UnresolvedType
add, forGenericType, forGenericTypeSignature, forGenericTypeVariables, forName, forNames, forPrimitiveType, forRawTypeName, forSignature, forSignatures, getBaseName, getClassName, getComponentType, getDimensions, getErasureSignature, getName, getNames, getOutermostType, getPackageName, getPackageNameAsIdentifier, getRawName, getSignature, getSimpleBaseName, getTypekind, getTypeParameters, getTypeVariableNamed, hashCode, insert, isArray, isParameterizedOrGenericType, isParameterizedOrRawType, isParameterizedType, isPrimitiveType, isRawType, isSimpleType, isTypeVariableReference, isVoid, makeArray, needsModifiableDelegate, read, readArray, resolve, setNeedsModifiableDelegate, toDebugString, toString, toTraceString, write, writeArrayModifier and TypeMethodDescriptionstatic UnresolvedType[]add(UnresolvedType[] types, UnresolvedType end) Creates a new type array with a fresh type appended to the end.static UnresolvedTypeforGenericType(String name, TypeVariable[] tvbs, String genericSig) static UnresolvedTypeforGenericTypeSignature(String sig, String declaredGenericSig) static UnresolvedTypeforGenericTypeVariables(String sig, TypeVariable[] tVars) static UnresolvedTypeNOTE: Use forSignature() if you can, it'll be cheaper ! Constructs a UnresolvedType for a java language type name.static UnresolvedType[]Constructs a UnresolvedType for each java language type name in an incoming array.static UnresolvedTypeforPrimitiveType(String signature) static UnresolvedTypeforRawTypeName(String name) static UnresolvedTypeforSignature(String signature) Constructs a Type for a JVM bytecode signature string.static UnresolvedType[]forSignatures(String[] sigs) Constructs a UnresolvedType for each JVM bytecode type signature in an incoming array.Returns a UnresolvedType object representing the component type of this array, or null if this type does not represent an array type.final intFor parameterized types, return the signature for the raw typegetName()Returns the name of this type in java language form (e.g.static String[]getNames(UnresolvedType[] types) Returns an array of strings representing the java langauge names of an array of types.Returns a UnresolvedType object representing the effective outermost enclosing type for a name type.Returns the name of this type in JVM signature form.getTypeVariableNamed(String name) inthashCode()Equality is checked based on the underlying signature, so the hash code of a particular type is the hash code of its signature string.static UnresolvedType[]insert(UnresolvedType start, UnresolvedType[] types) Creates a new type array with a fresh type inserted at the beginning.final booleanisArray()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisVoid()static UnresolvedTypemakeArray(UnresolvedType base, int dims) booleanstatic UnresolvedTypeRead in an UnresolvedType - just read the signature and rebuild the UnresolvedType.static UnresolvedType[]Returns a resolved version of this type according to a particular world.voidsetNeedsModifiableDelegate(boolean b) toString()Returns a java language string representation of this type.final voidWrite out an UnresolvedType - the signature should be enough.static voidwriteArray(UnresolvedType[] types, CompressingDataOutputStream stream)
-
Field Details
-
UNBOUND
public static final int UNBOUND- See Also:
-
EXTENDS
public static final int EXTENDS- See Also:
-
SUPER
public static final int SUPER- See Also:
-
kind
public int kind -
additionalInterfaceBounds
-
-
Constructor Details
-
BoundedReferenceType
-
BoundedReferenceType
public BoundedReferenceType(ReferenceType aBound, boolean isExtends, World world, ReferenceType[] additionalInterfaces) -
BoundedReferenceType
-
BoundedReferenceType
Constructs the BoundedReferenceType representing an unbounded wildcard '?'. In this situation the signature is '*' and the erased signature is Ljava/lang/Object;
-
-
Method Details
-
getUpperBound
-
getLowerBound
-
getAdditionalBounds
-
parameterize
Description copied from class:ResolvedTypeIff I am a parameterized type, and any of my parameters are type variable references (or nested parameterized types), return a version with those type parameters replaced in accordance with the passed bindings.- Overrides:
parameterizein classResolvedType
-
getSignatureForAttribute
- Overrides:
getSignatureForAttributein classReferenceType
-
hasLowerBound
public boolean hasLowerBound() -
isExtends
public boolean isExtends() -
isSuper
public boolean isSuper() -
isUnbound
public boolean isUnbound() -
alwaysMatches
-
canBeCoercedTo
-
getSimpleName
- Overrides:
getSimpleNamein classUnresolvedType
-
getDeclaredInterfaces
Description copied from class:ReferenceTypeFind out from the generic signature the true signature of any interfaces I implement. If I am parameterized, these may then need to be parameterized before returning.- Overrides:
getDeclaredInterfacesin classReferenceType
-
isGenericWildcard
public boolean isGenericWildcard()- Overrides:
isGenericWildcardin classUnresolvedType
-