org.aspectj.weaver
Class ResolvedMemberImpl

java.lang.Object
  extended by org.aspectj.weaver.MemberImpl
      extended by org.aspectj.weaver.ResolvedMemberImpl
All Implemented Interfaces:
java.lang.Comparable<Member>, AnnotatedElement, IHasPosition, Member, ResolvedMember, TypeVariableDeclaringElement
Direct Known Subclasses:
ReflectionBasedResolvedMemberImpl, ResolvedPointcutDefinition

public class ResolvedMemberImpl
extends MemberImpl
implements IHasPosition, ResolvedMember

Represent a resolved member. Components of it are expected to exist. This member will correspond to a real member *unless* it is being used to represent the effect of an ITD.


Field Summary
protected  AnnotationAJ[] annotations
           
protected  ResolvedType[] annotationTypes
           
protected  ResolvedMember backingGenericMember
          if this member is a parameterized version of a member in a generic type, then this field holds a reference to the member we parameterize.
protected  UnresolvedType[] checkedExceptions
           
protected  int end
           
protected  AnnotationAJ[][] parameterAnnotations
           
protected  ResolvedType[][] parameterAnnotationTypes
           
static boolean showParameterNames
           
protected  ISourceContext sourceContext
           
protected  int start
           
protected  TypeVariable[] typeVariables
           
 
Fields inherited from class org.aspectj.weaver.MemberImpl
declaringType, kind, modifiers, name, parameterTypes, returnType
 
Fields inherited from interface org.aspectj.weaver.ResolvedMember
NONE
 
Fields inherited from interface org.aspectj.weaver.Member
ADVICE, CONSTRUCTOR, FIELD, HANDLER, METHOD, MONITORENTER, MONITOREXIT, NO_PARAMETER_ANNOTATION_TYPES, NO_PARAMETER_ANNOTATIONXS, POINTCUT, STATIC_INITIALIZATION
 
Constructor Summary
ResolvedMemberImpl(MemberKind kind, UnresolvedType declaringType, int modifiers, java.lang.String name, java.lang.String signature)
           
ResolvedMemberImpl(MemberKind kind, UnresolvedType declaringType, int modifiers, UnresolvedType returnType, java.lang.String name, UnresolvedType[] parameterTypes)
           
ResolvedMemberImpl(MemberKind kind, UnresolvedType declaringType, int modifiers, UnresolvedType returnType, java.lang.String name, UnresolvedType[] parameterTypes, UnresolvedType[] checkedExceptions)
           
ResolvedMemberImpl(MemberKind kind, UnresolvedType declaringType, int modifiers, UnresolvedType returnType, java.lang.String name, UnresolvedType[] parameterTypes, UnresolvedType[] checkedExceptions, ResolvedMember backingGenericMember)
           
 
Method Summary
 void addAnnotation(AnnotationAJ annotation)
           
static void appendSigWithTypeVarBoundsRemoved(UnresolvedType aType, java.lang.StringBuffer toBuffer, java.util.Set<UnresolvedType> alreadyUsedTypeVars)
           
 void evictWeavingState()
           
 java.lang.String getAnnotationDefaultValue()
           
 AnnotationAJ getAnnotationOfType(UnresolvedType ofType)
           
 AnnotationAJ[] getAnnotations()
           
 ResolvedType[] getAnnotationTypes()
           
 ShadowMunger getAssociatedShadowMunger()
           
 ResolvedMember getBackingGenericMember()
           
 AjAttribute.EffectiveSignatureAttribute getEffectiveSignature()
           
 int getEnd()
          The ending index of this location in the character stream This points to the last character in this token.
 UnresolvedType[] getExceptions()
           
 UnresolvedType[] getExceptions(World world)
           
 UnresolvedType[] getGenericParameterTypes()
          Get the TypeXs of the parameter types, taking generic signature into account
 UnresolvedType getGenericReturnType()
          Get the UnresolvedType for the return type, taking generic signature into account
 java.lang.String getGenericSignature()
           
static JoinPointSignature[] getJoinPointSignatures(Member joinPointSignature, World inAWorld)
          Compute the full set of signatures for a member.
 int getModifiers()
           
 int getModifiers(World world)
           
 AnnotationAJ[][] getParameterAnnotations()
           
 ResolvedType[][] getParameterAnnotationTypes()
           
 java.lang.String[] getParameterNames()
           
 java.lang.String[] getParameterNames(World world)
           
 java.lang.String getParameterSignatureErased()
          Return the erased form of the signature with bounds collapsed for type variables, etc.
 java.lang.String getSignatureErased()
           
 java.lang.String getSignatureForAttribute()
          Return the member generic signature that would be suitable for inclusion in a class file Signature attribute.
 ISourceContext getSourceContext()
           
 ISourceContext getSourceContext(World world)
           
 ISourceLocation getSourceLocation()
           
 int getStart()
          The starting index of this location in the character stream.
 TypeVariable getTypeVariableNamed(java.lang.String name)
           
 TypeVariable[] getTypeVariables()
           
 boolean hasAnnotation(UnresolvedType ofType)
          Check if this member has an annotation of the specified type.
 boolean hasAnnotations()
           
 boolean hasBackingGenericMember()
          If this member is defined by a parameterized super-type, return the erasure of that member.
 boolean isAbstract()
           
 boolean isAjSynthetic()
           
 boolean isAnnotatedElsewhere()
           
 boolean isBridgeMethod()
           
 boolean isCompatibleWith(Member am)
           
 boolean isDefault()
           
 boolean isDefaultConstructor()
           
 boolean isEquivalentTo(java.lang.Object other)
           
 boolean isPublic()
           
 boolean isSynthetic()
           
 boolean isVarargsMethod()
           
 boolean isVisible(ResolvedType fromType)
           
 boolean matches(ResolvedMember aCandidateMatch, boolean ignoreGenerics)
          Returns true if this member matches the other.
protected  UnresolvedType parameterize(UnresolvedType aType, java.util.Map<java.lang.String,UnresolvedType> typeVariableMap, boolean inParameterizedType, World w)
           
 ResolvedMember parameterizedWith(java.util.Map<java.lang.String,UnresolvedType> m, World w)
          Replace occurrences of type variables in the signature with values contained in the map.
 ResolvedMemberImpl parameterizedWith(UnresolvedType[] typeParameters, ResolvedType newDeclaringType, boolean isParameterized)
           
 ResolvedMemberImpl parameterizedWith(UnresolvedType[] typeParameters, ResolvedType newDeclaringType, boolean isParameterized, java.util.List<java.lang.String> aliases)
          Return a resolvedmember in which all the type variables in the signature have been replaced with the given bindings.
static ResolvedMemberImpl readResolvedMember(VersionedDataInputStream s, ISourceContext sourceContext)
           
static ResolvedMember[] readResolvedMemberArray(VersionedDataInputStream s, ISourceContext context)
           
 void resetKind(MemberKind newKind)
           
 void resetModifiers(int newModifiers)
           
 void resetName(java.lang.String newName)
          For ITDs, we use the default factory methods to build a resolved member, then alter a couple of characteristics using this method - this is safe.
 void resetReturnTypeToObjectArray()
           
 ResolvedMember resolve(World world)
           
protected  void setAjSynthetic(boolean b)
           
 void setAnnotatedElsewhere(boolean b)
           
 void setAnnotationTypes(ResolvedType[] annotationTypes)
           
 void setCheckedExceptions(UnresolvedType[] checkedExceptions)
           
 void setDeclaringType(ReferenceType rt)
           
 void setParameterNames(java.lang.String[] pnames)
           
 void setPosition(int sourceStart, int sourceEnd)
           
 void setSourceContext(ISourceContext sourceContext)
           
 void setTypeVariables(TypeVariable[] tvars)
           
 void setVarargsMethod()
           
 java.lang.String toDebugString()
          Useful for writing tests, returns *everything* we know about this member.
 java.lang.String toGenericString()
           
 void write(CompressingDataOutputStream s)
           
static void writeArray(ResolvedMember[] members, CompressingDataOutputStream s)
           
 
Methods inherited from class org.aspectj.weaver.MemberImpl
canBeParameterized, compareTo, equals, equalsApartFromDeclaringType, field, getArity, getDeclaringType, getDeclaringTypes, getJoinPointSignatures, getKind, getName, getParameterSignature, getParameterTypes, getReturnType, getSignature, getType, hashCode, isInterface, isPrivate, isStatic, makeExceptionHandlerSignature, method, method, monitorEnter, monitorExit, pointcut, toString, typesToSignature, typesToSignature, wipeJoinpointSignatures
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.aspectj.weaver.ResolvedMember
equalsApartFromDeclaringType
 
Methods inherited from interface org.aspectj.weaver.Member
canBeParameterized, compareTo, getArity, getDeclaringType, getDeclaringTypes, getJoinPointSignatures, getKind, getName, getParameterSignature, getParameterTypes, getReturnType, getSignature, getType
 

Field Detail

checkedExceptions

protected UnresolvedType[] checkedExceptions

backingGenericMember

protected ResolvedMember backingGenericMember
if this member is a parameterized version of a member in a generic type, then this field holds a reference to the member we parameterize.


annotations

protected AnnotationAJ[] annotations

annotationTypes

protected ResolvedType[] annotationTypes

parameterAnnotations

protected AnnotationAJ[][] parameterAnnotations

parameterAnnotationTypes

protected ResolvedType[][] parameterAnnotationTypes

typeVariables

protected TypeVariable[] typeVariables

start

protected int start

end

protected int end

sourceContext

protected ISourceContext sourceContext

showParameterNames

public static boolean showParameterNames
Constructor Detail

ResolvedMemberImpl

public ResolvedMemberImpl(MemberKind kind,
                          UnresolvedType declaringType,
                          int modifiers,
                          UnresolvedType returnType,
                          java.lang.String name,
                          UnresolvedType[] parameterTypes)

ResolvedMemberImpl

public ResolvedMemberImpl(MemberKind kind,
                          UnresolvedType declaringType,
                          int modifiers,
                          UnresolvedType returnType,
                          java.lang.String name,
                          UnresolvedType[] parameterTypes,
                          UnresolvedType[] checkedExceptions)

ResolvedMemberImpl

public ResolvedMemberImpl(MemberKind kind,
                          UnresolvedType declaringType,
                          int modifiers,
                          UnresolvedType returnType,
                          java.lang.String name,
                          UnresolvedType[] parameterTypes,
                          UnresolvedType[] checkedExceptions,
                          ResolvedMember backingGenericMember)

ResolvedMemberImpl

public ResolvedMemberImpl(MemberKind kind,
                          UnresolvedType declaringType,
                          int modifiers,
                          java.lang.String name,
                          java.lang.String signature)
Method Detail

getJoinPointSignatures

public static JoinPointSignature[] getJoinPointSignatures(Member joinPointSignature,
                                                          World inAWorld)
Compute the full set of signatures for a member. This walks up the hierarchy giving the ResolvedMember in each defining type in the hierarchy. A shadowMember can be created with a target type (declaring type) that does not actually define the member. This is ok as long as the member is inherited in the declaring type. Each declaring type in the line to the actual declaring type is added as an additional signature. For example: class A { void foo(); } class B extends A {} shadowMember : void B.foo() gives { void B.foo(), void A.foo() }

Parameters:
joinPointSignature -
inAWorld -

getModifiers

public final int getModifiers(World world)
Specified by:
getModifiers in interface Member
Specified by:
getModifiers in interface ResolvedMember
Overrides:
getModifiers in class MemberImpl

getModifiers

public final int getModifiers()
Specified by:
getModifiers in interface Member
Specified by:
getModifiers in interface ResolvedMember
Overrides:
getModifiers in class MemberImpl

getExceptions

public final UnresolvedType[] getExceptions(World world)
Specified by:
getExceptions in interface Member
Specified by:
getExceptions in interface ResolvedMember
Overrides:
getExceptions in class MemberImpl

getExceptions

public UnresolvedType[] getExceptions()
Specified by:
getExceptions in interface ResolvedMember

getAssociatedShadowMunger

public ShadowMunger getAssociatedShadowMunger()
Specified by:
getAssociatedShadowMunger in interface ResolvedMember

isAjSynthetic

public boolean isAjSynthetic()
Specified by:
isAjSynthetic in interface ResolvedMember

setAjSynthetic

protected void setAjSynthetic(boolean b)

hasAnnotations

public boolean hasAnnotations()

hasAnnotation

public boolean hasAnnotation(UnresolvedType ofType)
Check if this member has an annotation of the specified type. If the member has a backing generic member then this member represents a parameterization of a member in a generic type and the annotations available on the backing generic member should be used.

Specified by:
hasAnnotation in interface AnnotatedElement
Specified by:
hasAnnotation in interface ResolvedMember
Parameters:
ofType - the type of the annotation being searched for
Returns:
true if the annotation is found on this member or its backing generic member

getAnnotationTypes

public ResolvedType[] getAnnotationTypes()
Specified by:
getAnnotationTypes in interface AnnotatedElement
Specified by:
getAnnotationTypes in interface ResolvedMember

getAnnotationDefaultValue

public java.lang.String getAnnotationDefaultValue()
Specified by:
getAnnotationDefaultValue in interface ResolvedMember

getAnnotations

public AnnotationAJ[] getAnnotations()
Specified by:
getAnnotations in interface Member
Specified by:
getAnnotations in interface ResolvedMember
Overrides:
getAnnotations in class MemberImpl

setAnnotationTypes

public void setAnnotationTypes(ResolvedType[] annotationTypes)
Specified by:
setAnnotationTypes in interface ResolvedMember

getParameterAnnotationTypes

public ResolvedType[][] getParameterAnnotationTypes()
Specified by:
getParameterAnnotationTypes in interface ResolvedMember

getParameterAnnotations

public AnnotationAJ[][] getParameterAnnotations()
Specified by:
getParameterAnnotations in interface ResolvedMember

addAnnotation

public void addAnnotation(AnnotationAJ annotation)
Specified by:
addAnnotation in interface ResolvedMember

isBridgeMethod

public boolean isBridgeMethod()
Specified by:
isBridgeMethod in interface ResolvedMember

isVarargsMethod

public boolean isVarargsMethod()
Specified by:
isVarargsMethod in interface ResolvedMember

setVarargsMethod

public void setVarargsMethod()

isSynthetic

public boolean isSynthetic()
Specified by:
isSynthetic in interface ResolvedMember

write

public void write(CompressingDataOutputStream s)
           throws java.io.IOException
Specified by:
write in interface ResolvedMember
Throws:
java.io.IOException

getSignatureForAttribute

public java.lang.String getSignatureForAttribute()
Return the member generic signature that would be suitable for inclusion in a class file Signature attribute. For: List getThem(T t) {} we would create: (TT;)Ljava/util/List;;

Returns:
the generic signature for the member that could be inserted into a class file

getGenericSignature

public java.lang.String getGenericSignature()

writeArray

public static void writeArray(ResolvedMember[] members,
                              CompressingDataOutputStream s)
                       throws java.io.IOException
Throws:
java.io.IOException

readResolvedMember

public static ResolvedMemberImpl readResolvedMember(VersionedDataInputStream s,
                                                    ISourceContext sourceContext)
                                             throws java.io.IOException
Throws:
java.io.IOException

readResolvedMemberArray

public static ResolvedMember[] readResolvedMemberArray(VersionedDataInputStream s,
                                                       ISourceContext context)
                                                throws java.io.IOException
Throws:
java.io.IOException

resolve

public ResolvedMember resolve(World world)
Specified by:
resolve in interface Member
Overrides:
resolve in class MemberImpl

getSourceContext

public ISourceContext getSourceContext(World world)
Specified by:
getSourceContext in interface ResolvedMember

getParameterNames

public java.lang.String[] getParameterNames()
Specified by:
getParameterNames in interface ResolvedMember

setParameterNames

public final void setParameterNames(java.lang.String[] pnames)
Specified by:
setParameterNames in interface ResolvedMember

getParameterNames

public final java.lang.String[] getParameterNames(World world)
Specified by:
getParameterNames in interface Member
Specified by:
getParameterNames in interface ResolvedMember
Overrides:
getParameterNames in class MemberImpl

getEffectiveSignature

public AjAttribute.EffectiveSignatureAttribute getEffectiveSignature()
Specified by:
getEffectiveSignature in interface ResolvedMember

getSourceLocation

public ISourceLocation getSourceLocation()
Specified by:
getSourceLocation in interface ResolvedMember

getEnd

public int getEnd()
Description copied from interface: IHasPosition
The ending index of this location in the character stream This points to the last character in this token. If a location truly had no contents, then start == end + 1. We don't recommend this.

Specified by:
getEnd in interface IHasPosition
Specified by:
getEnd in interface ResolvedMember

getSourceContext

public ISourceContext getSourceContext()
Specified by:
getSourceContext in interface ResolvedMember

getStart

public int getStart()
Description copied from interface: IHasPosition
The starting index of this location in the character stream.

Specified by:
getStart in interface IHasPosition
Specified by:
getStart in interface ResolvedMember

setPosition

public void setPosition(int sourceStart,
                        int sourceEnd)
Specified by:
setPosition in interface ResolvedMember

setDeclaringType

public void setDeclaringType(ReferenceType rt)

setSourceContext

public void setSourceContext(ISourceContext sourceContext)
Specified by:
setSourceContext in interface ResolvedMember

isAbstract

public boolean isAbstract()
Specified by:
isAbstract in interface ResolvedMember

isPublic

public boolean isPublic()
Specified by:
isPublic in interface ResolvedMember

isDefault

public boolean isDefault()
Specified by:
isDefault in interface ResolvedMember

isVisible

public boolean isVisible(ResolvedType fromType)
Specified by:
isVisible in interface ResolvedMember

setCheckedExceptions

public void setCheckedExceptions(UnresolvedType[] checkedExceptions)
Specified by:
setCheckedExceptions in interface ResolvedMember

setAnnotatedElsewhere

public void setAnnotatedElsewhere(boolean b)
Specified by:
setAnnotatedElsewhere in interface ResolvedMember

isAnnotatedElsewhere

public boolean isAnnotatedElsewhere()
Specified by:
isAnnotatedElsewhere in interface ResolvedMember

getGenericReturnType

public UnresolvedType getGenericReturnType()
Get the UnresolvedType for the return type, taking generic signature into account

Specified by:
getGenericReturnType in interface Member
Specified by:
getGenericReturnType in interface ResolvedMember
Overrides:
getGenericReturnType in class MemberImpl

getGenericParameterTypes

public UnresolvedType[] getGenericParameterTypes()
Get the TypeXs of the parameter types, taking generic signature into account

Specified by:
getGenericParameterTypes in interface Member
Specified by:
getGenericParameterTypes in interface ResolvedMember
Overrides:
getGenericParameterTypes in class MemberImpl

parameterizedWith

public ResolvedMemberImpl parameterizedWith(UnresolvedType[] typeParameters,
                                            ResolvedType newDeclaringType,
                                            boolean isParameterized)
Specified by:
parameterizedWith in interface ResolvedMember

parameterizedWith

public ResolvedMemberImpl parameterizedWith(UnresolvedType[] typeParameters,
                                            ResolvedType newDeclaringType,
                                            boolean isParameterized,
                                            java.util.List<java.lang.String> aliases)
Return a resolvedmember in which all the type variables in the signature have been replaced with the given bindings. The 'isParameterized' flag tells us whether we are creating a raw type version or not. if (isParameterized) then List will turn into List (for example) - if (!isParameterized) then List will turn into List.

Specified by:
parameterizedWith in interface ResolvedMember

parameterizedWith

public ResolvedMember parameterizedWith(java.util.Map<java.lang.String,UnresolvedType> m,
                                        World w)
Replace occurrences of type variables in the signature with values contained in the map. The map is of the form A=String,B=Integer and so a signature List Foo.m(B i) {} would become List Foo.m(Integer i) {}

Specified by:
parameterizedWith in interface ResolvedMember

setTypeVariables

public void setTypeVariables(TypeVariable[] tvars)
Specified by:
setTypeVariables in interface ResolvedMember

getTypeVariables

public TypeVariable[] getTypeVariables()
Specified by:
getTypeVariables in interface ResolvedMember

parameterize

protected UnresolvedType parameterize(UnresolvedType aType,
                                      java.util.Map<java.lang.String,UnresolvedType> typeVariableMap,
                                      boolean inParameterizedType,
                                      World w)

hasBackingGenericMember

public boolean hasBackingGenericMember()
If this member is defined by a parameterized super-type, return the erasure of that member. For example: interface I { T foo(T aTea); } class C implements I { String foo(String aString) { return "something"; } } The resolved member for C.foo has signature String foo(String). The erasure of that member is Object foo(Object) -- use upper bound of type variable. A type is a supertype of itself.

Specified by:
hasBackingGenericMember in interface ResolvedMember

getBackingGenericMember

public ResolvedMember getBackingGenericMember()
Specified by:
getBackingGenericMember in interface ResolvedMember

resetName

public void resetName(java.lang.String newName)
For ITDs, we use the default factory methods to build a resolved member, then alter a couple of characteristics using this method - this is safe.


resetKind

public void resetKind(MemberKind newKind)

resetModifiers

public void resetModifiers(int newModifiers)

resetReturnTypeToObjectArray

public void resetReturnTypeToObjectArray()

matches

public boolean matches(ResolvedMember aCandidateMatch,
                       boolean ignoreGenerics)
Returns true if this member matches the other. The matching takes into account name and parameter types only. When comparing parameter types, we allow any type variable to match any other type variable regardless of bounds.

Specified by:
matches in interface ResolvedMember

getParameterSignatureErased

public java.lang.String getParameterSignatureErased()
Return the erased form of the signature with bounds collapsed for type variables, etc. Does not include the return type, @see getParam

Specified by:
getParameterSignatureErased in interface ResolvedMember

getSignatureErased

public java.lang.String getSignatureErased()
Specified by:
getSignatureErased in interface ResolvedMember

appendSigWithTypeVarBoundsRemoved

public static void appendSigWithTypeVarBoundsRemoved(UnresolvedType aType,
                                                     java.lang.StringBuffer toBuffer,
                                                     java.util.Set<UnresolvedType> alreadyUsedTypeVars)

toDebugString

public java.lang.String toDebugString()
Useful for writing tests, returns *everything* we know about this member.

Specified by:
toDebugString in interface ResolvedMember

toGenericString

public java.lang.String toGenericString()
Specified by:
toGenericString in interface ResolvedMember

isCompatibleWith

public boolean isCompatibleWith(Member am)
Specified by:
isCompatibleWith in interface ResolvedMember

getTypeVariableNamed

public TypeVariable getTypeVariableNamed(java.lang.String name)
Specified by:
getTypeVariableNamed in interface TypeVariableDeclaringElement

evictWeavingState

public void evictWeavingState()
Specified by:
evictWeavingState in interface ResolvedMember

getAnnotationOfType

public AnnotationAJ getAnnotationOfType(UnresolvedType ofType)
Specified by:
getAnnotationOfType in interface AnnotatedElement

isEquivalentTo

public boolean isEquivalentTo(java.lang.Object other)

isDefaultConstructor

public boolean isDefaultConstructor()
Specified by:
isDefaultConstructor in interface ResolvedMember