Package org.aspectj.weaver
Class ResolvedType
java.lang.Object
org.aspectj.weaver.UnresolvedType
org.aspectj.weaver.ResolvedType
- All Implemented Interfaces:
AnnotatedElement
,Traceable
,TypeVariableDeclaringElement
- Direct Known Subclasses:
MissingResolvedTypeWithKnownSignature
,ReferenceType
-
Nested Class Summary
Nested classes/interfaces inherited from class org.aspectj.weaver.UnresolvedType
UnresolvedType.TypeKind
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
static ResolvedType[]
static ResolvedType[]
protected List<ConcreteTypeMunger>
static org.aspectj.weaver.ResolvedType.Missing
static ResolvedType[]
static String
protected World
Fields inherited from class org.aspectj.weaver.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, VOID
-
Constructor Summary
ModifierConstructorDescriptionprotected
ResolvedType(String signature, String signatureErasure, World world)
protected
ResolvedType(String signature, World world)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotation(AnnotationAJ annotationX)
void
addInterTypeMunger(ConcreteTypeMunger munger, boolean isDuringCompilation)
Add an intertype munger to this type. isDuringCompilation tells us if we should be checking for an error scenario where two ITD fields are trying to use the same name.void
addParent(ResolvedType newParent)
protected boolean
boolean
Note: Only overridden by ReferenceType subtypeboolean
canBeSeenBy(ResolvedType from)
void
Check: 1) That we don't have any abstract type mungers unless this type is abstract. 2) That an abstract ITDM on an interface is declared public.boolean
checkLegalOverride(ResolvedMember parent, ResolvedMember child, int transformerPosition, ResolvedType aspectType)
void
collectCrosscuttingMembers(boolean shouldConcretizeIfNeeded)
collectDeclares(boolean includeAdviceLike)
protected void
collectInterTypeMungers(List<ConcreteTypeMunger> collector)
static boolean
conflictingSignature(Member m1, Member m2)
static boolean
conflictingSignature(Member m1, Member m2, boolean v2itds)
Do the two members conflict?discoverActualOccurrenceOfTypeInHierarchy(ResolvedType lookingFor)
Look up the actual occurence of a particular type in the hierarchy for 'this' type.protected boolean
void
Undo 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).boolean
Equality 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>
getAnnotationOfType(UnresolvedType ofType)
Note: Only overridden by ReferenceType subtypeReturns the path to the jar or class file from which this binary aspect came or null if not a binary aspectint
return the weaver version used to build this type - defaults to the most recent version unless discovered otherwise.abstract ResolvedMember[]
abstract ResolvedType[]
abstract ResolvedMember[]
abstract ResolvedMember[]
Returns a ResolvedType object representing the declaring type of this type, or null if this type does not represent a non-package-level-type.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.Overridden by ReferenceType to return a sensible answer for parameterized and raw types.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.???protected 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.abstract int
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).int
getSize()
This is the size of this type as used in JVM.abstract ISourceContext
abstract ResolvedType
getTopmostImplementor(ResolvedType interfaceType)
getWorld()
boolean
boolean
boolean
Note: Only overridden by Name subtype.boolean
boolean
Note: Only overridden by Name subtype.boolean
boolean
isAspect()
abstract boolean
isAssignableFrom(ResolvedType other)
Determines if the variables of this type could be assigned values of another type without casting.abstract boolean
isAssignableFrom(ResolvedType other, boolean allowMissing)
boolean
boolean
boolean
isClass()
abstract boolean
isCoerceableFrom(ResolvedType other)
Determines if values of another type could possibly be cast to this type.boolean
isConvertableFrom(ResolvedType other)
Determines if variables of this type could be assigned values of another with lots of help. java.lang.Object is convertable from all types.boolean
isEnum()
Note: Only overridden by Name subtype.boolean
boolean
boolean
isFinal()
boolean
boolean
For an annotation type, this will return if it is marked with @Inheritedboolean
boolean
static boolean
isMissing(UnresolvedType unresolved)
static boolean
isMoreVisible(int m1, int m2)
boolean
isNested()
boolean
return true if the parameterization of this type includes a member type variable.boolean
boolean
boolean
boolean
isTopmostImplementor(ResolvedType interfaceType)
boolean
static boolean
isVisible(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. return null if not foundlookupMemberWithSupersAndITDs(Member member)
lookupMethod(Member m)
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 ResolvedType
makeArray(ResolvedType type, int dim)
static boolean
boolean
parameterize(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.parameterizedWith(UnresolvedType[] typeParameters)
void
setBinaryPath(String binaryPath)
void
Methods inherited from class org.aspectj.weaver.UnresolvedType
add, forGenericType, forGenericTypeSignature, forGenericTypeVariables, forName, forNames, forPrimitiveType, forRawTypeName, forSignature, forSignatures, getBaseName, getClassName, getComponentType, getErasureSignature, getName, getNameAsIdentifier, getNames, getOutermostType, getPackageName, getPackageNameAsIdentifier, getRawName, getSignature, getSimpleBaseName, getSimpleName, getTypekind, getTypeParameters, getTypeVariableNamed, getTypeVariables, hashCode, insert, isArray, isGenericType, isGenericWildcard, isParameterizedOrGenericType, isParameterizedOrRawType, isParameterizedType, isPrimitiveType, isRawType, isSimpleType, isTypeVariableReference, isVoid, makeArray, needsModifiableDelegate, read, readArray, resolve, setNeedsModifiableDelegate, toDebugString, toString, toTraceString, write, writeArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.aspectj.weaver.AnnotatedElement
hasAnnotation
-
Field Details
-
EMPTY_RESOLVED_TYPE_ARRAY
-
PARAMETERIZED_TYPE_IDENTIFIER
- See Also:
- Constant Field Values
-
temporaryAnnotationTypes
-
world
-
bits
protected int bits -
validBoxing
-
crosscuttingMembers
-
NONE
-
EMPTY_ARRAY
-
MISSING
public static final org.aspectj.weaver.ResolvedType.Missing MISSING -
interTypeMungers
-
-
Constructor Details
-
ResolvedType
-
ResolvedType
-
-
Method Details
-
getSize
public int getSize()Description copied from class:UnresolvedType
This is the size of this type as used in JVM.- Overrides:
getSize
in classUnresolvedType
-
getDirectSupertypes
Returns an iterator through ResolvedType objects representing all the direct supertypes of this type. That is, through the superclass, if any, and all declared interfaces. -
getDeclaredFields
-
getDeclaredMethods
-
getDeclaredInterfaces
-
getDeclaredPointcuts
-
isCacheable
public boolean isCacheable() -
getSuperclass
- Returns:
- the superclass of this type, or null (if this represents a jlObject, primitive, or void)
-
getModifiers
public abstract int getModifiers() -
canBeSeenBy
-
isMissing
public boolean isMissing() -
isMissing
-
getAnnotationTypes
- Specified by:
getAnnotationTypes
in interfaceAnnotatedElement
-
getAnnotationOfType
- Specified by:
getAnnotationOfType
in interfaceAnnotatedElement
-
getResolvedComponentType
-
getWorld
-
equals
Description copied from class:UnresolvedType
Equality is checked based on the underlying signature.- Overrides:
equals
in classUnresolvedType
-
getFields
returns an iterator through all of the fields of this type, in order for checking from JVM spec 2ed 5.4.3.2. This means that the order is- fields from current class
- recur into direct superinterfaces
- recur into superclass
We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land.
-
getMethods
returns an iterator through all of the methods of this type, in order for checking from JVM spec 2ed 5.4.3.3. This means that the order is- methods from current class
- recur into superclass, all the way up, not touching interfaces
- recur into all superinterfaces, in some unspecified order (but those 'closest' to this type are first)
- Parameters:
wantGenerics
- is true if the caller would like all generics information, otherwise those methods are collapsed to their erasure
-
getMethodsIncludingIntertypeDeclarations
public Iterator<ResolvedMember> getMethodsIncludingIntertypeDeclarations(boolean wantGenerics, boolean wantDeclaredParents) -
getHierarchy
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).- Returns:
- an iterator over all types in the hierarchy of this type
-
getHierarchy
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).- Parameters:
wantGenerics
- true if the caller wants full generic informationwantDeclaredParents
- true if the caller even wants those parents introduced via declare parents- Returns:
- an iterator over all types in the hierarchy of this type
-
getMethodsWithoutIterator
public List<ResolvedMember> 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. This is expensive - use the getMethods() method if you can! -
getHierarchyWithoutIterator
public List<ResolvedType> getHierarchyWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware)Return a list of the types in the hierarchy of this type, starting with this type. The order in the list is the superclasses followed by the super interfaces.- Parameters:
genericsAware
- should the list include parameterized/generic types (if not, they will be collapsed to raw)?- Returns:
- list of resolvedtypes in this types hierarchy, including this type first
-
getResolvedTypeParameters
-
lookupField
described in JVM spec 2ed 5.4.3.2 -
lookupMethod
described in JVM spec 2ed 5.4.3.3. Doesnt check ITDs.Check the current type for the method. If it is not found, check the super class and any super interfaces. Taking care not to process interfaces multiple times.
-
lookupMethodInITDs
- Parameters:
member
- the member to lookup in intertype declarations affecting this type- Returns:
- the real signature defined by any matching intertype declaration, otherwise null
-
lookupResolvedMember
public ResolvedMember lookupResolvedMember(ResolvedMember aMember, boolean allowMissing, boolean eraseGenerics)Looks for the first member in the hierarchy matching aMember. This method differs from lookupMember(Member) in that it takes into account parameters which are type variables - which clearly an unresolved Member cannot do since it does not know anything about type variables. -
matches
-
conflictingSignature
-
conflictingSignature
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. The conflict detection below had to be altered. Previously (<1.7.1) it is not a conflict if the declaring types are different. With v2itds it may still be a conflict if the declaring types are different. -
getPointcuts
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). This means that the order is- pointcuts from current class
- recur into direct superinterfaces
- recur into superclass
We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land.
-
findPointcut
-
collectCrosscuttingMembers
-
collectDeclares
-
addParent
-
doesNotExposeShadowMungers
protected boolean doesNotExposeShadowMungers() -
getPerClause
-
getDeclares
-
getTypeMungers
-
getPrivilegedAccesses
-
isInterface
public final boolean isInterface() -
isAbstract
public final boolean isAbstract() -
isClass
public boolean isClass() -
isAspect
public boolean isAspect() -
isAnnotationStyleAspect
public boolean isAnnotationStyleAspect() -
isEnum
public boolean isEnum()Note: Only overridden by Name subtype. -
isAnnotation
public boolean isAnnotation()Note: Only overridden by Name subtype. -
isAnonymous
public boolean isAnonymous() -
isNested
public boolean isNested() -
getOuterClass
-
addAnnotation
-
getAnnotations
-
hasAnnotations
public boolean hasAnnotations() -
canAnnotationTargetType
public boolean canAnnotationTargetType()Note: Only overridden by ReferenceType subtype -
getAnnotationTargetKinds
Note: Only overridden by ReferenceType subtype -
isAnnotationWithRuntimeRetention
public boolean isAnnotationWithRuntimeRetention()Note: Only overridden by Name subtype. -
isSynthetic
public boolean isSynthetic() -
isFinal
public final boolean isFinal() -
getMemberParameterizationMap
-
getDeclaredAdvice
-
getDeclaredShadowMungers
-
getDeclaredJavaFields
-
getDeclaredJavaMethods
-
getSourceContext
-
makeArray
-
lookupMemberNoSupers
Look up a member, takes into account any ITDs on this type. return null if not found -
lookupMemberWithSupersAndITDs
-
lookupDirectlyDeclaredMemberNoSupers
as lookupMemberNoSupers, but does not include ITDs- Parameters:
member
-- Returns:
-
lookupMemberIncludingITDsOnInterfaces
This lookup has specialized behaviour - a null result tells the EclipseTypeMunger that it should make a default implementation of a method on this type.- Parameters:
member
-- Returns:
-
getInterTypeMungers
-
getInterTypeParentMungers
-
getInterTypeMungersIncludingSupers
??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my super -
getInterTypeParentMungersIncludingSupers
-
collectInterTypeMungers
-
checkInterTypeMungers
public void checkInterTypeMungers()Check: 1) That we don't have any abstract type mungers unless this type is abstract. 2) That an abstract ITDM on an interface is declared public. (Compiler limitation) (PR70794) -
getDeclaringType
Returns a ResolvedType object representing the declaring type of this type, or null if this type does not represent a non-package-level-type.Warning: This is guaranteed to work for all member types. For anonymous/local types, the only guarantee is given in JLS 13.1, where it guarantees that if you call getDeclaringType() repeatedly, you will eventually get the top-level class, but it does not say anything about classes in between.
- Returns:
- the declaring type, or null if it is not an nested type.
-
isVisible
-
discoverActualOccurrenceOfTypeInHierarchy
Look up the actual occurence of a particular type in the hierarchy for 'this' type. The input is going to be a generic type, and the caller wants to know if it was used in its RAW or a PARAMETERIZED form in this hierarchy. returns null if it can't be found. -
fillInAnyTypeParameters
Called for all type mungers but only does something if they share type variables with a generic type which they target. When this happens this routine will check for the target type in the target hierarchy and 'bind' any type parameters as appropriate. For example, for the ITD "List<T> I<T>.x" against a type like this: "class A implements I<String>" this routine will return a parameterized form of the ITD "List<String> I.x" -
addInterTypeMunger
Add an intertype munger to this type. isDuringCompilation tells us if we should be checking for an error scenario where two ITD fields are trying to use the same name. When this happens during compilation one of them is altered to get mangled name but when it happens during weaving it is too late and we need to put out an error asking them to recompile. -
checkLegalOverride
public boolean checkLegalOverride(ResolvedMember parent, ResolvedMember child, int transformerPosition, ResolvedType aspectType)- Parameters:
transformerPosition
- which parameter is the type transformer (0x10 for first, 0x01 for second, 0x11 for both, 0x00 for neither)aspectType
- the declaring type of aspect defining the *first* type transformer- Returns:
- true if the override is legal note: calling showMessage with two locations issues TWO messages, not ONE message with an additional source location.
-
isMoreVisible
public static boolean isMoreVisible(int m1, int m2) -
lookupSyntheticMember
-
clearInterTypeMungers
public void clearInterTypeMungers() -
isTopmostImplementor
-
getTopmostImplementor
-
getExposedPointcuts
-
getSourceLocation
-
isExposedToWeaver
public boolean isExposedToWeaver() -
getWeaverState
-
getGenericType
Overridden by ReferenceType to return a sensible answer for parameterized and raw types.- Returns:
-
getRawType
- Overrides:
getRawType
in classUnresolvedType
-
parameterizedWith
-
parameterize
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.- Overrides:
parameterize
in classUnresolvedType
-
isException
public boolean isException()- Returns:
- true if assignable to java.lang.Exception
-
isCheckedException
public boolean isCheckedException()- Returns:
- true if it is an exception and it is a checked one, false otherwise.
-
isConvertableFrom
Determines if variables of this type could be assigned values of another with lots of help. java.lang.Object is convertable from all types. A primitive type is convertable from X iff it's assignable from X. A reference type is convertable from X iff it's coerceable from X. In other words, X isConvertableFrom Y iff the compiler thinks that _some_ value of Y could be assignable to a variable of type X without loss of precision.- Parameters:
other
- the other type- Returns:
- true iff variables of this type could be assigned values of other with possible conversion
-
isAssignableFrom
Determines if the variables of this type could be assigned values of another type without casting. This still allows for assignment conversion as per JLS 2ed 5.2. For object types, this means supertypeOrEqual(THIS, OTHER).- Parameters:
other
- the other type- Returns:
- true iff variables of this type could be assigned values of other without casting
- Throws:
NullPointerException
- if other is null
-
isAssignableFrom
-
isCoerceableFrom
Determines if values of another type could possibly be cast to this type. The rules followed are from JLS 2ed 5.5, "Casting Conversion".This method should be commutative, i.e., for all UnresolvedType a, b and all World w:
a.isCoerceableFrom(b, w) == b.isCoerceableFrom(a, w)
- Parameters:
other
- the other type- Returns:
- true iff values of other could possibly be cast to this type.
- Throws:
NullPointerException
- if other is null.
-
needsNoConversionFrom
-
getSignatureForAttribute
-
isParameterizedWithTypeVariable
public boolean isParameterizedWithTypeVariable()return true if the parameterization of this type includes a member type variable. Member type variables occur in generic methods/ctors. -
ajMembersNeedParameterization
protected boolean ajMembersNeedParameterization() -
getAjMemberParameterizationMap
-
setBinaryPath
-
getBinaryPath
Returns the path to the jar or class file from which this binary aspect came or null if not a binary aspect -
ensureConsistent
public void ensureConsistent()Undo 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). -
isInheritedAnnotation
public boolean isInheritedAnnotation()For an annotation type, this will return if it is marked with @Inherited -
tagAsTypeHierarchyComplete
public void tagAsTypeHierarchyComplete() -
isTypeHierarchyComplete
public boolean isTypeHierarchyComplete() -
getCompilerVersion
public int getCompilerVersion()return the weaver version used to build this type - defaults to the most recent version unless discovered otherwise.- Returns:
- the (major) version,
AjAttribute.WeaverVersionInfo
-
isPrimitiveArray
public boolean isPrimitiveArray() -
isGroovyObject
public boolean isGroovyObject() -
isPrivilegedAspect
public boolean isPrivilegedAspect()
-