@@ -152,6 +152,16 @@ public abstract class Advice extends ShadowMunger { | |||
} else if (kind == AdviceKind.PerTargetEntry) { | |||
return shadow.hasTarget(); | |||
} else if (kind == AdviceKind.PerThisEntry) { | |||
// Groovy Constructors have a strange switch statement in them - this switch statement can leave us in places where | |||
// the | |||
// instance is not initialized (a super ctor hasn't been called yet). | |||
// In these situations it isn't safe to do a perObjectBind, the instance is not initialized and cannot be passed | |||
// over. | |||
if (shadow.getEnclosingCodeSignature().getName().equals("<init>")) { | |||
if (world.resolve(shadow.getEnclosingType()).isGroovyObject()) { | |||
return false; | |||
} | |||
} | |||
return shadow.hasThis(); | |||
} else if (kind == AdviceKind.Around) { | |||
if (shadow.getKind() == Shadow.PreInitialization) { | |||
@@ -170,8 +180,8 @@ public abstract class Advice extends ShadowMunger { | |||
} else { | |||
// System.err.println(getSignature().getReturnType() + | |||
// " from " + shadow.getReturnType()); | |||
if (getSignature().getReturnType() == ResolvedType.VOID) { | |||
if (shadow.getReturnType() != ResolvedType.VOID) { | |||
if (getSignature().getReturnType().equals(UnresolvedType.VOID)) { | |||
if (!shadow.getReturnType().equals(UnresolvedType.VOID)) { | |||
world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.NON_VOID_RETURN, shadow), | |||
getSourceLocation(), shadow.getSourceLocation()); | |||
return false; | |||
@@ -351,7 +361,7 @@ public abstract class Advice extends ShadowMunger { | |||
while ((baseParmCnt + 1 < parameterTypes.length) | |||
&& (parameterTypes[baseParmCnt].equals(AjcMemberMaker.TYPEX_JOINPOINT) | |||
|| parameterTypes[baseParmCnt].equals(AjcMemberMaker.TYPEX_STATICJOINPOINT) || parameterTypes[baseParmCnt] | |||
.equals(AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT))) { | |||
.equals(AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT))) { | |||
baseParmCnt++; | |||
} | |||
return parameterTypes[baseParmCnt]; | |||
@@ -473,7 +483,10 @@ public abstract class Advice extends ShadowMunger { | |||
public static final int ConstantReference = 0x10; | |||
// When the above flag is set, this indicates whether it is true or false | |||
public static final int ConstantValue = 0x20; | |||
public static final int CanInline = 0x40; | |||
// public static final int CanInline = 0x40; // didnt appear to be getting used | |||
public static final int ThisAspectInstance = 0x40; | |||
// cant use 0x80 ! the value is written out as a byte and -1 has special meaning (-1 is 0x80...) | |||
// for testing only | |||
public void setLexicalPosition(int lexicalPosition) { |
@@ -88,8 +88,8 @@ public class AjcMemberMaker { | |||
if (!UnresolvedType.SERIALIZABLE.resolve(aspectType.getWorld()).isAssignableFrom(aspectType)) { | |||
modifiers |= Modifier.TRANSIENT; | |||
} | |||
return new ResolvedMemberImpl(Member.FIELD, declaringType, modifiers, aspectType, NameMangler | |||
.perObjectInterfaceField(aspectType), UnresolvedType.NONE); | |||
return new ResolvedMemberImpl(Member.FIELD, declaringType, modifiers, aspectType, | |||
NameMangler.perObjectInterfaceField(aspectType), UnresolvedType.NONE); | |||
} | |||
// PTWIMPL ResolvedMember for aspect instance field, declared in matched type | |||
@@ -98,8 +98,8 @@ public class AjcMemberMaker { | |||
if (!isSerializableAspect(aspectType)) { | |||
modifiers |= Modifier.TRANSIENT; | |||
} | |||
return new ResolvedMemberImpl(Member.FIELD, declaringType, modifiers, aspectType, NameMangler | |||
.perTypeWithinFieldForTarget(aspectType), UnresolvedType.NONE); | |||
return new ResolvedMemberImpl(Member.FIELD, declaringType, modifiers, aspectType, | |||
NameMangler.perTypeWithinFieldForTarget(aspectType), UnresolvedType.NONE); | |||
} | |||
// PTWIMPL ResolvedMember for type instance field, declared in aspect | |||
@@ -133,8 +133,8 @@ public class AjcMemberMaker { | |||
// PTWIMPL ResolvedMember for getWithinTypeName() method | |||
public static ResolvedMember perTypeWithinGetWithinTypeNameMethod(UnresolvedType declaringType, boolean inJava5Mode) { | |||
// public String getWithinTypeName() | |||
ResolvedMemberImpl rm = new ResolvedMemberImpl(Member.METHOD, declaringType, Modifier.PUBLIC, | |||
UnresolvedType.JL_STRING, // return value | |||
ResolvedMemberImpl rm = new ResolvedMemberImpl(Member.METHOD, declaringType, Modifier.PUBLIC, UnresolvedType.JL_STRING, // return | |||
// value | |||
NameMangler.PERTYPEWITHIN_GETWITHINTYPENAME_METHOD, UnresolvedType.NONE); | |||
return rm; | |||
} | |||
@@ -142,8 +142,8 @@ public class AjcMemberMaker { | |||
public static ResolvedMember perTypeWithinCreateAspectInstance(UnresolvedType declaringType) { | |||
// public static a.X ajc$createAspectInstance(java.lang.String) | |||
ResolvedMemberImpl rm = new ResolvedMemberImpl(Member.METHOD, declaringType, PUBLIC_STATIC, declaringType, // return value | |||
NameMangler.PERTYPEWITHIN_CREATEASPECTINSTANCE_METHOD, new UnresolvedType[] { UnresolvedType | |||
.forSignature("Ljava/lang/String;") }, new UnresolvedType[] {}); | |||
NameMangler.PERTYPEWITHIN_CREATEASPECTINSTANCE_METHOD, | |||
new UnresolvedType[] { UnresolvedType.forSignature("Ljava/lang/String;") }, new UnresolvedType[] {}); | |||
return rm; | |||
} | |||
@@ -224,7 +224,7 @@ public class AjcMemberMaker { | |||
} else { | |||
parameterType = UnresolvedType.forSignature("Ljava/lang/Class;"); | |||
} | |||
return new ResolvedMemberImpl(Member.METHOD, declaringType, PUBLIC_STATIC, ResolvedType.BOOLEAN, "hasAspect", | |||
return new ResolvedMemberImpl(Member.METHOD, declaringType, PUBLIC_STATIC, UnresolvedType.BOOLEAN, "hasAspect", | |||
new UnresolvedType[] { parameterType }); | |||
// return new ResolvedMemberImpl(Member.METHOD, | |||
// declaringType, PUBLIC_STATIC, "hasAspect", | |||
@@ -235,9 +235,9 @@ public class AjcMemberMaker { | |||
public static ResolvedMember privilegedAccessMethodForMethod(UnresolvedType aspectType, ResolvedMember method) { | |||
return new ResolvedMemberImpl(Member.METHOD, method.getDeclaringType(), Modifier.PUBLIC | |||
| (Modifier.isStatic(method.getModifiers()) ? Modifier.STATIC : 0), method.getReturnType(), NameMangler | |||
.privilegedAccessMethodForMethod(method.getName(), method.getDeclaringType(), aspectType), method | |||
.getParameterTypes(), method.getExceptions()); | |||
| (Modifier.isStatic(method.getModifiers()) ? Modifier.STATIC : 0), method.getReturnType(), | |||
NameMangler.privilegedAccessMethodForMethod(method.getName(), method.getDeclaringType(), aspectType), | |||
method.getParameterTypes(), method.getExceptions()); | |||
} | |||
/** | |||
@@ -294,7 +294,7 @@ public class AjcMemberMaker { | |||
} | |||
StringBuffer name = new StringBuffer("ajc$set$"); | |||
name.append(field.getName()); | |||
return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, ResolvedType.VOID, name.toString(), | |||
return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, UnresolvedType.VOID, name.toString(), | |||
args); | |||
} else { | |||
String setterName = NameMangler.privilegedAccessMethodForFieldSet(field.getName(), fieldDeclaringType, aspectType); | |||
@@ -315,8 +315,8 @@ public class AjcMemberMaker { | |||
// if (!method.isStatic()) { | |||
// paramTypes = UnresolvedType.insert(method.getDeclaringType(), paramTypes); | |||
// } | |||
return new ResolvedMemberImpl(Member.METHOD, baseType, Modifier.PUBLIC, method.getReturnType(), NameMangler | |||
.superDispatchMethod(baseType, method.getName()), paramTypes, method.getExceptions()); | |||
return new ResolvedMemberImpl(Member.METHOD, baseType, Modifier.PUBLIC, method.getReturnType(), | |||
NameMangler.superDispatchMethod(baseType, method.getName()), paramTypes, method.getExceptions()); | |||
} | |||
public static ResolvedMember inlineAccessMethodForMethod(UnresolvedType aspectType, ResolvedMember method) { | |||
@@ -387,14 +387,14 @@ public class AjcMemberMaker { | |||
public static ResolvedMember preIntroducedConstructor(UnresolvedType aspectType, UnresolvedType targetType, | |||
UnresolvedType[] paramTypes) { | |||
return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC_FINAL, UnresolvedType.OBJECTARRAY, NameMangler | |||
.preIntroducedConstructor(aspectType, targetType), paramTypes); | |||
return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC_FINAL, UnresolvedType.OBJECTARRAY, | |||
NameMangler.preIntroducedConstructor(aspectType, targetType), paramTypes); | |||
} | |||
public static ResolvedMember postIntroducedConstructor(UnresolvedType aspectType, UnresolvedType targetType, | |||
UnresolvedType[] paramTypes) { | |||
return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC_FINAL, ResolvedType.VOID, NameMangler | |||
.postIntroducedConstructor(aspectType, targetType), UnresolvedType.insert(targetType, paramTypes)); | |||
return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC_FINAL, UnresolvedType.VOID, | |||
NameMangler.postIntroducedConstructor(aspectType, targetType), UnresolvedType.insert(targetType, paramTypes)); | |||
} | |||
public static ResolvedMember itdAtDeclareParentsField(ResolvedType targetType, UnresolvedType itdType, UnresolvedType aspectType) { | |||
@@ -403,12 +403,12 @@ public class AjcMemberMaker { | |||
} | |||
public static ResolvedMember interConstructor(ResolvedType targetType, ResolvedMember constructor, UnresolvedType aspectType) { | |||
// | |||
// | |||
// ResolvedType targetType, | |||
// UnresolvedType[] argTypes, | |||
// int modifiers) | |||
// { | |||
ResolvedMember ret = new ResolvedMemberImpl(Member.CONSTRUCTOR, targetType, Modifier.PUBLIC, ResolvedType.VOID, "<init>", | |||
ResolvedMember ret = new ResolvedMemberImpl(Member.CONSTRUCTOR, targetType, Modifier.PUBLIC, UnresolvedType.VOID, "<init>", | |||
constructor.getParameterTypes(), constructor.getExceptions()); | |||
// System.out.println("ret: " + ret + " mods: " + Modifier.toString(modifiers)); | |||
if (Modifier.isPublic(constructor.getModifiers())) { | |||
@@ -423,8 +423,8 @@ public class AjcMemberMaker { | |||
} | |||
public static ResolvedMember interFieldInitializer(ResolvedMember field, UnresolvedType aspectType) { | |||
return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, NameMangler.interFieldInitializer(aspectType, field | |||
.getDeclaringType(), field.getName()), Modifier.isStatic(field.getModifiers()) ? "()V" : "(" | |||
return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, NameMangler.interFieldInitializer(aspectType, | |||
field.getDeclaringType(), field.getName()), Modifier.isStatic(field.getModifiers()) ? "()V" : "(" | |||
+ field.getDeclaringType().getSignature() + ")V"); | |||
} | |||
@@ -440,10 +440,10 @@ public class AjcMemberMaker { | |||
* This static method goes on the aspect that declares the inter-type field | |||
*/ | |||
public static ResolvedMember interFieldSetDispatcher(ResolvedMember field, UnresolvedType aspectType) { | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, ResolvedType.VOID, NameMangler | |||
.interFieldSetDispatcher(aspectType, field.getDeclaringType(), field.getName()), Modifier.isStatic(field | |||
.getModifiers()) ? new UnresolvedType[] { field.getReturnType() } : new UnresolvedType[] { | |||
field.getDeclaringType(), field.getReturnType() }); | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, UnresolvedType.VOID, | |||
NameMangler.interFieldSetDispatcher(aspectType, field.getDeclaringType(), field.getName()), Modifier.isStatic(field | |||
.getModifiers()) ? new UnresolvedType[] { field.getReturnType() } : new UnresolvedType[] { | |||
field.getDeclaringType(), field.getReturnType() }); | |||
rm.setTypeVariables(field.getTypeVariables()); | |||
return rm; | |||
} | |||
@@ -452,9 +452,10 @@ public class AjcMemberMaker { | |||
* This static method goes on the aspect that declares the inter-type field | |||
*/ | |||
public static ResolvedMember interFieldGetDispatcher(ResolvedMember field, UnresolvedType aspectType) { | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, field.getReturnType(), NameMangler | |||
.interFieldGetDispatcher(aspectType, field.getDeclaringType(), field.getName()), Modifier.isStatic(field | |||
.getModifiers()) ? UnresolvedType.NONE : new UnresolvedType[] { field.getDeclaringType() }, UnresolvedType.NONE); | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, field.getReturnType(), | |||
NameMangler.interFieldGetDispatcher(aspectType, field.getDeclaringType(), field.getName()), Modifier.isStatic(field | |||
.getModifiers()) ? UnresolvedType.NONE : new UnresolvedType[] { field.getDeclaringType() }, | |||
UnresolvedType.NONE); | |||
rm.setTypeVariables(field.getTypeVariables()); | |||
return rm; | |||
} | |||
@@ -498,9 +499,9 @@ public class AjcMemberMaker { | |||
if (onType.isInterface()) { | |||
modifiers |= Modifier.ABSTRACT; | |||
} | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, onType, modifiers, ResolvedType.VOID, NameMangler | |||
.interFieldInterfaceSetter(aspectType, field.getDeclaringType(), field.getName()), new UnresolvedType[] { field | |||
.getReturnType() }, UnresolvedType.NONE); | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, onType, modifiers, UnresolvedType.VOID, | |||
NameMangler.interFieldInterfaceSetter(aspectType, field.getDeclaringType(), field.getName()), | |||
new UnresolvedType[] { field.getReturnType() }, UnresolvedType.NONE); | |||
rm.setTypeVariables(field.getTypeVariables()); | |||
return rm; | |||
} | |||
@@ -513,8 +514,8 @@ public class AjcMemberMaker { | |||
if (onType.isInterface()) { | |||
modifiers |= Modifier.ABSTRACT; | |||
} | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, onType, modifiers, field.getReturnType(), NameMangler | |||
.interFieldInterfaceGetter(aspectType, field.getDeclaringType(), field.getName()), UnresolvedType.NONE, | |||
ResolvedMember rm = new ResolvedMemberImpl(Member.METHOD, onType, modifiers, field.getReturnType(), | |||
NameMangler.interFieldInterfaceGetter(aspectType, field.getDeclaringType(), field.getName()), UnresolvedType.NONE, | |||
UnresolvedType.NONE); | |||
rm.setTypeVariables(field.getTypeVariables()); | |||
return rm; | |||
@@ -535,8 +536,8 @@ public class AjcMemberMaker { | |||
} | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, meth.getDeclaringType(), modifiers, meth.getReturnType(), | |||
NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), meth | |||
.getParameterTypes(), meth.getExceptions()); | |||
NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), | |||
meth.getParameterTypes(), meth.getExceptions()); | |||
rmi.setParameterNames(meth.getParameterNames()); | |||
rmi.setTypeVariables(meth.getTypeVariables()); | |||
return rmi; | |||
@@ -556,8 +557,8 @@ public class AjcMemberMaker { | |||
} | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, meth.getDeclaringType(), modifiers, meth.getReturnType(), | |||
NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), meth | |||
.getParameterTypes(), meth.getExceptions()); | |||
NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), | |||
meth.getParameterTypes(), meth.getExceptions()); | |||
rmi.setTypeVariables(meth.getTypeVariables()); | |||
return rmi; | |||
} | |||
@@ -572,9 +573,9 @@ public class AjcMemberMaker { | |||
int modifiers = makePublicNonFinal(meth.getModifiers()); | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, modifiers, meth.getReturnType(), NameMangler | |||
.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), meth.getParameterTypes(), | |||
meth.getExceptions()); | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, modifiers, meth.getReturnType(), | |||
NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), | |||
meth.getParameterTypes(), meth.getExceptions()); | |||
rmi.setTypeVariables(meth.getTypeVariables()); | |||
return rmi; | |||
} | |||
@@ -589,8 +590,9 @@ public class AjcMemberMaker { | |||
paramTypes = UnresolvedType.insert(meth.getDeclaringType(), paramTypes); | |||
} | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, meth.getReturnType(), NameMangler | |||
.interMethodDispatcher(aspectType, meth.getDeclaringType(), meth.getName()), paramTypes, meth.getExceptions()); | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, meth.getReturnType(), | |||
NameMangler.interMethodDispatcher(aspectType, meth.getDeclaringType(), meth.getName()), paramTypes, | |||
meth.getExceptions()); | |||
rmi.setParameterNames(meth.getParameterNames()); | |||
rmi.setTypeVariables(meth.getTypeVariables()); | |||
@@ -611,8 +613,8 @@ public class AjcMemberMaker { | |||
modifiers |= Modifier.STRICT; | |||
} | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, modifiers, meth.getReturnType(), NameMangler | |||
.interMethodBody(aspectType, meth.getDeclaringType(), meth.getName()), paramTypes, meth.getExceptions()); | |||
ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, modifiers, meth.getReturnType(), | |||
NameMangler.interMethodBody(aspectType, meth.getDeclaringType(), meth.getName()), paramTypes, meth.getExceptions()); | |||
rmi.setParameterNames(meth.getParameterNames()); | |||
rmi.setTypeVariables(meth.getTypeVariables()); | |||
return rmi; |
@@ -197,7 +197,7 @@ public class CrosscuttingMembers { | |||
} | |||
addTypeMunger(world.getWeavingSupport().concreteTypeMunger(new ExposeTypeMunger(typeToExpose), inAspect)); | |||
// ResolvedMember member = new ResolvedMemberImpl( | |||
// Member.STATIC_INITIALIZATION, typeToExpose, 0, ResolvedType.VOID, | |||
// Member.STATIC_INITIALIZATION, typeToExpose, 0, UnresolvedType.VOID, | |||
// "<clinit>", UnresolvedType.NONE); | |||
// addTypeMunger(world.concreteTypeMunger( | |||
// new PrivilegedAccessMunger(member), inAspect)); |
@@ -17,7 +17,7 @@ package org.aspectj.weaver; | |||
public class ExposeTypeMunger extends PrivilegedAccessMunger { | |||
public ExposeTypeMunger(UnresolvedType typeToExpose) { | |||
super(new ResolvedMemberImpl(Member.STATIC_INITIALIZATION, typeToExpose, 0, ResolvedType.VOID, "<clinit>", | |||
super(new ResolvedMemberImpl(Member.STATIC_INITIALIZATION, typeToExpose, 0, UnresolvedType.VOID, "<clinit>", | |||
UnresolvedType.NONE), false); | |||
} | |||
@@ -233,12 +233,12 @@ public class MemberImpl implements Member { | |||
} | |||
public static MemberImpl monitorEnter() { | |||
return new MemberImpl(MONITORENTER, UnresolvedType.OBJECT, Modifier.STATIC, ResolvedType.VOID, "<lock>", | |||
return new MemberImpl(MONITORENTER, UnresolvedType.OBJECT, Modifier.STATIC, UnresolvedType.VOID, "<lock>", | |||
UnresolvedType.ARRAY_WITH_JUST_OBJECT); | |||
} | |||
public static MemberImpl monitorExit() { | |||
return new MemberImpl(MONITOREXIT, UnresolvedType.OBJECT, Modifier.STATIC, ResolvedType.VOID, "<unlock>", | |||
return new MemberImpl(MONITOREXIT, UnresolvedType.OBJECT, Modifier.STATIC, UnresolvedType.VOID, "<unlock>", | |||
UnresolvedType.ARRAY_WITH_JUST_OBJECT); | |||
} | |||
@@ -23,7 +23,7 @@ public class ResolvedPointcutDefinition extends ResolvedMemberImpl { | |||
public ResolvedPointcutDefinition(UnresolvedType declaringType, int modifiers, String name, UnresolvedType[] parameterTypes, | |||
Pointcut pointcut) { | |||
this(declaringType, modifiers, name, parameterTypes, ResolvedType.VOID, pointcut); | |||
this(declaringType, modifiers, name, parameterTypes, UnresolvedType.VOID, pointcut); | |||
} | |||
/** | |||
@@ -111,16 +111,16 @@ public class ResolvedPointcutDefinition extends ResolvedMemberImpl { | |||
typeMap.put(typeVariables[i].getName(), ut); | |||
} | |||
} | |||
UnresolvedType parameterizedReturnType = parameterize(getGenericReturnType(), typeMap, isParameterized, newDeclaringType | |||
.getWorld()); | |||
UnresolvedType parameterizedReturnType = parameterize(getGenericReturnType(), typeMap, isParameterized, | |||
newDeclaringType.getWorld()); | |||
UnresolvedType[] parameterizedParameterTypes = new UnresolvedType[getGenericParameterTypes().length]; | |||
for (int i = 0; i < parameterizedParameterTypes.length; i++) { | |||
parameterizedParameterTypes[i] = parameterize(getGenericParameterTypes()[i], typeMap, isParameterized, newDeclaringType | |||
.getWorld()); | |||
parameterizedParameterTypes[i] = parameterize(getGenericParameterTypes()[i], typeMap, isParameterized, | |||
newDeclaringType.getWorld()); | |||
} | |||
ResolvedPointcutDefinition ret = new ResolvedPointcutDefinition(newDeclaringType, getModifiers(), getName(), | |||
parameterizedParameterTypes, parameterizedReturnType, pointcut.parameterizeWith(typeMap, newDeclaringType | |||
.getWorld())); | |||
parameterizedParameterTypes, parameterizedReturnType, pointcut.parameterizeWith(typeMap, | |||
newDeclaringType.getWorld())); | |||
ret.setTypeVariables(getTypeVariables()); | |||
ret.setSourceContext(getSourceContext()); | |||
ret.setPosition(getStart(), getEnd()); |
@@ -57,6 +57,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl | |||
private static int MungersAnalyzed = 0x0004; | |||
private static int HasParentMunger = 0x0008; | |||
private static int TypeHierarchyCompleteBit = 0x0010; | |||
private static int GroovyObjectInitialized = 0x0020; | |||
private static int IsGroovyObject = 0x0040; | |||
protected ResolvedType(String signature, World world) { | |||
super(signature); | |||
@@ -68,6 +70,10 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl | |||
this.world = world; | |||
} | |||
public int getSize() { | |||
return 1; | |||
} | |||
/** | |||
* 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. | |||
@@ -1014,33 +1020,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl | |||
public static final ResolvedType[] NONE = new ResolvedType[0]; | |||
public static final ResolvedType[] EMPTY_ARRAY = NONE; | |||
public static final Primitive BYTE = new Primitive("B", 1, 0); | |||
public static final Primitive CHAR = new Primitive("C", 1, 1); | |||
public static final Primitive DOUBLE = new Primitive("D", 2, 2); | |||
public static final Primitive FLOAT = new Primitive("F", 1, 3); | |||
public static final Primitive INT = new Primitive("I", 1, 4); | |||
public static final Primitive LONG = new Primitive("J", 2, 5); | |||
public static final Primitive SHORT = new Primitive("S", 1, 6); | |||
public static final Primitive VOID = new Primitive("V", 0, 8); | |||
public static final Primitive BOOLEAN = new Primitive("Z", 1, 7); | |||
public static final Missing MISSING = new Missing(); | |||
/** Reset the static state in the primitive types */ | |||
// OPTIMIZE I think we have a bug here because primitives are static and the | |||
// world they use may vary (or may even be | |||
// null) | |||
public static void resetPrimitives() { | |||
BYTE.world = null; | |||
CHAR.world = null; | |||
DOUBLE.world = null; | |||
FLOAT.world = null; | |||
INT.world = null; | |||
LONG.world = null; | |||
SHORT.world = null; | |||
VOID.world = null; | |||
BOOLEAN.world = null; | |||
} | |||
// ---- types | |||
public static ResolvedType makeArray(ResolvedType type, int dim) { | |||
if (dim == 0) { | |||
@@ -1113,6 +1094,9 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl | |||
@Override | |||
public ResolvedType resolve(World world) { | |||
if (this.world != world) { | |||
throw new IllegalStateException(); | |||
} | |||
this.world = world; | |||
return super.resolve(world); | |||
} | |||
@@ -2136,12 +2120,16 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl | |||
private void interTypeConflictError(ConcreteTypeMunger m1, ConcreteTypeMunger m2) { | |||
// XXX this works only if we ignore separate compilation issues | |||
// XXX dual errors possible if (this instanceof BcelObjectType) return; | |||
/* | |||
* if (m1.getMunger().getKind() == ResolvedTypeMunger.Field && m2.getMunger().getKind() == ResolvedTypeMunger.Field) { // if | |||
* *exactly* the same, it's ok return true; } | |||
*/ | |||
// System.err.println("conflict at " + m2.getSourceLocation()); | |||
getWorld().showMessage( | |||
IMessage.ERROR, | |||
WeaverMessages.format(WeaverMessages.ITD_CONFLICT, m1.getAspectType().getName(), m2.getSignature(), m2 | |||
.getAspectType().getName()), m2.getSourceLocation(), getSourceLocation()); | |||
// return false; | |||
} | |||
public ResolvedMember lookupSyntheticMember(Member member) { | |||
@@ -2159,7 +2147,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl | |||
// Handling members for the new array join point | |||
if (world.isJoinpointArrayConstructionEnabled() && this.isArray()) { | |||
if (member.getKind() == Member.CONSTRUCTOR) { | |||
ResolvedMemberImpl ret = new ResolvedMemberImpl(Member.CONSTRUCTOR, this, Modifier.PUBLIC, ResolvedType.VOID, | |||
ResolvedMemberImpl ret = new ResolvedMemberImpl(Member.CONSTRUCTOR, this, Modifier.PUBLIC, UnresolvedType.VOID, | |||
"<init>", world.resolve(member.getParameterTypes())); | |||
// Give the parameters names - they are going to be the dimensions uses to build the array (dim0 > dimN) | |||
int count = ret.getParameterTypes().length; | |||
@@ -2777,4 +2765,31 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl | |||
public boolean isPrimitiveArray() { | |||
return false; | |||
} | |||
public boolean isGroovyObject() { | |||
if ((bits & GroovyObjectInitialized) == 0) { | |||
ResolvedType[] intfaces = getDeclaredInterfaces(); | |||
boolean done = false; | |||
// TODO do we need to walk more of these? (i.e. the interfaces interfaces and supertypes supertype). Check what groovy | |||
// does in the case where a hierarchy is involved and there are types in between GroovyObject/GroovyObjectSupport and | |||
// the type | |||
if (intfaces != null) { | |||
for (ResolvedType intface : intfaces) { | |||
if (intface.getName().equals("groovy.lang.GroovyObject")) { | |||
bits |= IsGroovyObject; | |||
done = true; | |||
break; | |||
} | |||
} | |||
} | |||
if (!done) { | |||
// take a look at the supertype | |||
if (getSuperclass().getName().equals("groovy.lang.GroovyObjectSupport")) { | |||
bits |= IsGroovyObject; | |||
} | |||
} | |||
bits |= GroovyObjectInitialized; | |||
} | |||
return (bits & IsGroovyObject) != 0; | |||
} | |||
} |
@@ -160,12 +160,13 @@ public abstract class Shadow { | |||
dims += (s.charAt(pos) == '[' ? 1 : 0); | |||
} | |||
} | |||
ResolvedType intType = UnresolvedType.INT.resolve(this.getIWorld()); | |||
if (dims == 1) { | |||
return new ResolvedType[] { ResolvedType.INT }; | |||
return new ResolvedType[] { intType }; | |||
} | |||
ResolvedType[] someInts = new ResolvedType[dims]; | |||
for (int i = 0; i < dims; i++) { | |||
someInts[i] = ResolvedType.INT; | |||
someInts[i] = intType; | |||
} | |||
return someInts; | |||
} | |||
@@ -220,6 +221,8 @@ public abstract class Shadow { | |||
public abstract Var getThisEnclosingJoinPointStaticPartVar(); | |||
public abstract Var getThisAspectInstanceVar(ResolvedType aspectType); | |||
// annotation variables | |||
public abstract Var getKindedAnnotationVar(UnresolvedType forAnnotationType); | |||
@@ -275,9 +278,9 @@ public abstract class Shadow { | |||
if (kind == ConstructorCall) { | |||
return getSignature().getDeclaringType(); | |||
} else if (kind == FieldSet) { | |||
return ResolvedType.VOID; | |||
return UnresolvedType.VOID; | |||
} else if (kind == SynchronizationLock || kind == SynchronizationUnlock) { | |||
return ResolvedType.VOID; | |||
return UnresolvedType.VOID; | |||
} | |||
return getResolvedSignature().getGenericReturnType(); | |||
} | |||
@@ -550,7 +553,7 @@ public abstract class Shadow { | |||
// Bunch of code to work out whether to report xlints for advice that isn't ordered at this Joinpoint | |||
possiblyReportUnorderedAdvice(sorted); | |||
if (sorted == null) { | |||
// this means that we have circular dependencies | |||
for (ShadowMunger m : mungers) { | |||
@@ -625,7 +628,7 @@ public abstract class Shadow { | |||
/** Actually implement the (non-empty) mungers associated with this shadow */ | |||
private void implementMungers() { | |||
World world = getIWorld(); | |||
for (ShadowMunger munger: mungers) { | |||
for (ShadowMunger munger : mungers) { | |||
if (munger.implementOn(this)) { | |||
world.reportMatch(munger, this); | |||
} |
@@ -140,7 +140,7 @@ public class TypeFactory { | |||
s.append(typeParameter.getSignature()); | |||
} | |||
s.append(">;"); | |||
signature = s.toString();//'P' + signature.substring(1); | |||
signature = s.toString();// 'P' + signature.substring(1); | |||
return new UnresolvedType(signature, signatureErasure, typeParams); | |||
} | |||
// can't replace above with convertSigToType - leads to stackoverflow | |||
@@ -173,23 +173,23 @@ public class TypeFactory { | |||
switch (firstChar) { | |||
case 'V': | |||
return ResolvedType.VOID; | |||
return UnresolvedType.VOID; | |||
case 'Z': | |||
return ResolvedType.BOOLEAN; | |||
return UnresolvedType.BOOLEAN; | |||
case 'B': | |||
return ResolvedType.BYTE; | |||
return UnresolvedType.BYTE; | |||
case 'C': | |||
return ResolvedType.CHAR; | |||
return UnresolvedType.CHAR; | |||
case 'D': | |||
return ResolvedType.DOUBLE; | |||
return UnresolvedType.DOUBLE; | |||
case 'F': | |||
return ResolvedType.FLOAT; | |||
return UnresolvedType.FLOAT; | |||
case 'I': | |||
return ResolvedType.INT; | |||
return UnresolvedType.INT; | |||
case 'J': | |||
return ResolvedType.LONG; | |||
return UnresolvedType.LONG; | |||
case 'S': | |||
return ResolvedType.SHORT; | |||
return UnresolvedType.SHORT; | |||
} | |||
} else if (firstChar == '@') { | |||
// missing type | |||
@@ -238,7 +238,7 @@ public class TypeFactory { | |||
s.append(typeParameter.getSignature()); | |||
} | |||
s.append(">;"); | |||
signature = s.toString();//'P' + signature.substring(1); | |||
signature = s.toString();// 'P' + signature.substring(1); | |||
return new UnresolvedType(signature, signatureErasure, typeParams); | |||
} | |||
@@ -62,6 +62,16 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement { | |||
public static final UnresolvedType JOINPOINT_STATICPART = forSignature("Lorg/aspectj/lang/JoinPoint$StaticPart;"); | |||
public static final UnresolvedType JOINPOINT_ENCLOSINGSTATICPART = forSignature("Lorg/aspectj/lang/JoinPoint$EnclosingStaticPart;"); | |||
public static final UnresolvedType BOOLEAN = forPrimitiveType("Z"); | |||
public static final UnresolvedType BYTE = forPrimitiveType("B"); | |||
public static final UnresolvedType CHAR = forPrimitiveType("C"); | |||
public static final UnresolvedType DOUBLE = forPrimitiveType("D"); | |||
public static final UnresolvedType FLOAT = forPrimitiveType("F"); | |||
public static final UnresolvedType INT = forPrimitiveType("I"); | |||
public static final UnresolvedType LONG = forPrimitiveType("J"); | |||
public static final UnresolvedType SHORT = forPrimitiveType("S"); | |||
public static final UnresolvedType VOID = forPrimitiveType("V"); | |||
// A type is considered missing if we have a signature for it but cannot find the delegate | |||
public static final String MISSING_NAME = "@missing@"; | |||
@@ -196,9 +206,11 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement { | |||
* This is the size of this type as used in JVM. | |||
*/ | |||
public int getSize() { | |||
return 1; | |||
return size; | |||
} | |||
private int size = 1; | |||
/** | |||
* NOTE: Use forSignature() if you can, it'll be cheaper ! Constructs a UnresolvedType for a java language type name. For | |||
* example: | |||
@@ -301,6 +313,17 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement { | |||
return ret; | |||
} | |||
public static UnresolvedType forPrimitiveType(String signature) { | |||
UnresolvedType ret = new UnresolvedType(signature); | |||
ret.typeKind = TypeKind.PRIMITIVE; | |||
if (signature.equals("J") || signature.equals("D")) { | |||
ret.size = 2; | |||
} else if (signature.equals("V")) { | |||
ret.size = 0; | |||
} | |||
return ret; | |||
} | |||
/** | |||
* Creates a new type array with a fresh type appended to the end. | |||
* | |||
@@ -360,27 +383,27 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement { | |||
assert !(signature.startsWith("L") && signature.indexOf("<") != -1); | |||
switch (signature.charAt(0)) { | |||
case 'B': | |||
return ResolvedType.BYTE; | |||
return UnresolvedType.BYTE; | |||
case 'C': | |||
return ResolvedType.CHAR; | |||
return UnresolvedType.CHAR; | |||
case 'D': | |||
return ResolvedType.DOUBLE; | |||
return UnresolvedType.DOUBLE; | |||
case 'F': | |||
return ResolvedType.FLOAT; | |||
return UnresolvedType.FLOAT; | |||
case 'I': | |||
return ResolvedType.INT; | |||
return UnresolvedType.INT; | |||
case 'J': | |||
return ResolvedType.LONG; | |||
return UnresolvedType.LONG; | |||
case 'L': | |||
return TypeFactory.createTypeFromSignature(signature); | |||
case 'P': | |||
return TypeFactory.createTypeFromSignature(signature); | |||
case 'S': | |||
return ResolvedType.SHORT; | |||
return UnresolvedType.SHORT; | |||
case 'V': | |||
return ResolvedType.VOID; | |||
return UnresolvedType.VOID; | |||
case 'Z': | |||
return ResolvedType.BOOLEAN; | |||
return UnresolvedType.BOOLEAN; | |||
case '[': | |||
return TypeFactory.createTypeFromSignature(signature); | |||
case '+': |
@@ -37,6 +37,7 @@ import org.aspectj.bridge.Message; | |||
import org.aspectj.bridge.MessageUtil; | |||
import org.aspectj.bridge.context.PinpointingMessageHandler; | |||
import org.aspectj.util.IStructureModel; | |||
import org.aspectj.weaver.ResolvedType.Primitive; | |||
import org.aspectj.weaver.UnresolvedType.TypeKind; | |||
import org.aspectj.weaver.patterns.Declare; | |||
import org.aspectj.weaver.patterns.DeclareAnnotation; | |||
@@ -177,28 +178,32 @@ public abstract class World implements Dump.INode { | |||
} | |||
} | |||
public final Primitive BYTE = new Primitive("B", 1, 0); | |||
public final Primitive CHAR = new Primitive("C", 1, 1); | |||
public final Primitive DOUBLE = new Primitive("D", 2, 2); | |||
public final Primitive FLOAT = new Primitive("F", 1, 3); | |||
public final Primitive INT = new Primitive("I", 1, 4); | |||
public final Primitive LONG = new Primitive("J", 2, 5); | |||
public final Primitive SHORT = new Primitive("S", 1, 6); | |||
public final Primitive BOOLEAN = new Primitive("Z", 1, 7); | |||
public final Primitive VOID = new Primitive("V", 0, 8); | |||
/** | |||
* Play God. On the first day, God created the primitive types and put them in the type map. | |||
* Insert the primitives | |||
*/ | |||
protected World() { | |||
super(); | |||
if (trace.isTraceEnabled()) { | |||
trace.enter("<init>", this); | |||
} | |||
// Dump.registerNode(this.getClass(), this); | |||
typeMap.put("B", ResolvedType.BYTE); | |||
typeMap.put("S", ResolvedType.SHORT); | |||
typeMap.put("I", ResolvedType.INT); | |||
typeMap.put("J", ResolvedType.LONG); | |||
typeMap.put("F", ResolvedType.FLOAT); | |||
typeMap.put("D", ResolvedType.DOUBLE); | |||
typeMap.put("C", ResolvedType.CHAR); | |||
typeMap.put("Z", ResolvedType.BOOLEAN); | |||
typeMap.put("V", ResolvedType.VOID); | |||
typeMap.put("B", BYTE); | |||
typeMap.put("S", SHORT); | |||
typeMap.put("I", INT); | |||
typeMap.put("J", LONG); | |||
typeMap.put("F", FLOAT); | |||
typeMap.put("D", DOUBLE); | |||
typeMap.put("C", CHAR); | |||
typeMap.put("Z", BOOLEAN); | |||
typeMap.put("V", VOID); | |||
precedenceCalculator = new AspectPrecedenceCalculator(this); | |||
if (trace.isTraceEnabled()) { | |||
trace.exit("<init>"); | |||
} | |||
} | |||
/** | |||
@@ -221,10 +226,8 @@ public abstract class World implements Dump.INode { | |||
} | |||
// ========================================================================== | |||
// === | |||
// T Y P E R E S O L U T I O N | |||
// ========================================================================== | |||
// === | |||
/** | |||
* Resolve a type that we require to be present in the world | |||
@@ -1975,7 +1978,7 @@ public abstract class World implements Dump.INode { | |||
} | |||
public static void reset() { | |||
ResolvedType.resetPrimitives(); | |||
// ResolvedType.resetPrimitives(); | |||
} | |||
/** |
@@ -129,8 +129,8 @@ public class ConcreteCflowPointcut extends Pointcut { | |||
for (Iterator i = slots.iterator(); i.hasNext();) { | |||
Slot slot = (Slot) i.next(); | |||
// System.out.println("slot: " + slot.formalIndex); | |||
state.set(slot.formalIndex, aspect.getWorld().getWeavingSupport().makeCflowAccessVar(slot.formalType, | |||
cflowField, slot.arrayIndex)); | |||
state.set(slot.formalIndex, | |||
aspect.getWorld().getWeavingSupport().makeCflowAccessVar(slot.formalType, cflowField, slot.arrayIndex)); | |||
} | |||
} | |||
return Test.makeFieldGetCall(cflowField, cflowStackIsValidMethod, Expr.NONE); | |||
@@ -138,10 +138,10 @@ public class ConcreteCflowPointcut extends Pointcut { | |||
} | |||
private static final Member cflowStackIsValidMethod = MemberImpl.method(NameMangler.CFLOW_STACK_UNRESOLVEDTYPE, 0, | |||
ResolvedType.BOOLEAN, "isValid", UnresolvedType.NONE); | |||
UnresolvedType.BOOLEAN, "isValid", UnresolvedType.NONE); | |||
private static final Member cflowCounterIsValidMethod = MemberImpl.method(NameMangler.CFLOW_COUNTER_UNRESOLVEDTYPE, 0, | |||
ResolvedType.BOOLEAN, "isValid", UnresolvedType.NONE); | |||
UnresolvedType.BOOLEAN, "isValid", UnresolvedType.NONE); | |||
public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) { | |||
throw new RuntimeException("unimplemented"); |
@@ -26,6 +26,7 @@ public class ExposedState { | |||
private boolean[] erroneousVars; | |||
private Expr aspectInstance; | |||
private UnresolvedType[] expectedVarTypes; // enables us to check that binding is occurring with the *right* types | |||
private ResolvedType concreteAspect; | |||
public ExposedState(int size) { | |||
super(); | |||
@@ -105,4 +106,12 @@ public class ExposedState { | |||
public boolean isErroneousVar(int formalIndex) { | |||
return erroneousVars[formalIndex]; | |||
} | |||
public void setConcreteAspect(ResolvedType concreteAspect) { | |||
this.concreteAspect = concreteAspect; | |||
} | |||
public ResolvedType getConcreteAspect() { | |||
return this.concreteAspect; | |||
} | |||
} |
@@ -191,7 +191,7 @@ public class IfPointcut extends Pointcut { | |||
} | |||
Test ret = Literal.TRUE; | |||
List args = new ArrayList(); | |||
List<Var> args = new ArrayList<Var>(); | |||
// code style | |||
if (extraParameterFlags >= 0) { | |||
@@ -214,6 +214,7 @@ public class IfPointcut extends Pointcut { | |||
// If there are no args to sort out, don't bother with the recursive call | |||
if (baseArgsCount > 0) { | |||
ExposedState myState = new ExposedState(baseArgsCount); | |||
myState.setConcreteAspect(state.getConcreteAspect()); | |||
// ??? we throw out the test that comes from this walk. All we want here | |||
// is bindings for the arguments | |||
residueSource.findResidue(shadow, myState); | |||
@@ -251,6 +252,10 @@ public class IfPointcut extends Pointcut { | |||
if ((extraParameterFlags & Advice.ThisEnclosingJoinPointStaticPart) != 0) { | |||
args.add(shadow.getThisEnclosingJoinPointStaticPartVar()); | |||
} | |||
if ((extraParameterFlags & Advice.ThisAspectInstance) != 0) { | |||
args.add(shadow.getThisAspectInstanceVar(state.getConcreteAspect())); | |||
} | |||
} else { | |||
// @style is slightly different | |||
int currentStateIndex = 0; | |||
@@ -272,16 +277,20 @@ public class IfPointcut extends Pointcut { | |||
if (paramNames != null) { | |||
errorParameter.append(testMethod.getParameterTypes()[i].getName()).append(" "); | |||
errorParameter.append(paramNames[i]); | |||
shadow.getIWorld().getMessageHandler().handleMessage( | |||
MessageUtil.error("Missing binding for if() pointcut method. Parameter " + (i + 1) + "(" | |||
+ errorParameter.toString() | |||
+ ") must be bound - even in reference pointcuts (compiler limitation)", | |||
testMethod.getSourceLocation())); | |||
shadow.getIWorld() | |||
.getMessageHandler() | |||
.handleMessage( | |||
MessageUtil.error("Missing binding for if() pointcut method. Parameter " + (i + 1) | |||
+ "(" + errorParameter.toString() | |||
+ ") must be bound - even in reference pointcuts (compiler limitation)", | |||
testMethod.getSourceLocation())); | |||
} else { | |||
shadow.getIWorld().getMessageHandler().handleMessage( | |||
MessageUtil.error("Missing binding for if() pointcut method. Parameter " + (i + 1) | |||
+ " must be bound - even in reference pointcuts (compiler limitation)", testMethod | |||
.getSourceLocation())); | |||
shadow.getIWorld() | |||
.getMessageHandler() | |||
.handleMessage( | |||
MessageUtil.error("Missing binding for if() pointcut method. Parameter " + (i + 1) | |||
+ " must be bound - even in reference pointcuts (compiler limitation)", | |||
testMethod.getSourceLocation())); | |||
} | |||
return Literal.TRUE; // exit quickly | |||
} | |||
@@ -293,8 +302,8 @@ public class IfPointcut extends Pointcut { | |||
} | |||
args.add(v); | |||
ret = Test.makeAnd(ret, Test.makeInstanceof(v, testMethod.getParameterTypes()[i] | |||
.resolve(shadow.getIWorld()))); | |||
ret = Test.makeAnd(ret, | |||
Test.makeInstanceof(v, testMethod.getParameterTypes()[i].resolve(shadow.getIWorld()))); | |||
} | |||
} | |||
} |
@@ -279,14 +279,14 @@ public class KindedPointcut extends Pointcut { | |||
return; | |||
} | |||
SignaturePattern nonConfusingPattern = new SignaturePattern(signature.getKind(), signature.getModifiers(), signature | |||
.getReturnType(), TypePattern.ANY, signature.getName(), signature.getParameterTypes(), | |||
SignaturePattern nonConfusingPattern = new SignaturePattern(signature.getKind(), signature.getModifiers(), | |||
signature.getReturnType(), TypePattern.ANY, signature.getName(), signature.getParameterTypes(), | |||
signature.getThrowsPattern(), signature.getAnnotationPattern()); | |||
if (nonConfusingPattern.matches(shadow.getSignature(), shadow.getIWorld(), true)) { | |||
shadow.getIWorld().getLint().unmatchedSuperTypeInCall.signal(new String[] { | |||
shadow.getSignature().getDeclaringType().toString(), signature.getDeclaringType().toString() }, this | |||
.getSourceLocation(), new ISourceLocation[] { shadow.getSourceLocation() }); | |||
shadow.getSignature().getDeclaringType().toString(), signature.getDeclaringType().toString() }, | |||
this.getSourceLocation(), new ISourceLocation[] { shadow.getSourceLocation() }); | |||
} | |||
} | |||
@@ -384,7 +384,7 @@ public class KindedPointcut extends Pointcut { | |||
// fields can't have a void type! | |||
UnresolvedType returnType = signature.getReturnType().getExactType(); | |||
if (returnType == ResolvedType.VOID) { | |||
if (returnType.equals(UnresolvedType.VOID)) { | |||
scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.FIELDS_CANT_HAVE_VOID_TYPE), | |||
getSourceLocation())); | |||
} | |||
@@ -413,8 +413,9 @@ public class KindedPointcut extends Pointcut { | |||
HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor(); | |||
signature.getDeclaringType().traverse(visitor, null); | |||
if (visitor.wellHasItThen/* ? */()) { | |||
scope.message(MessageUtil.error(WeaverMessages | |||
.format(WeaverMessages.EXECUTION_DOESNT_SUPPORT_PARAMETERIZED_DECLARING_TYPES), getSourceLocation())); | |||
scope.message(MessageUtil.error( | |||
WeaverMessages.format(WeaverMessages.EXECUTION_DOESNT_SUPPORT_PARAMETERIZED_DECLARING_TYPES), | |||
getSourceLocation())); | |||
} | |||
visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor(); | |||
@@ -430,8 +431,9 @@ public class KindedPointcut extends Pointcut { | |||
HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor(); | |||
signature.getDeclaringType().traverse(visitor, null); | |||
if (visitor.wellHasItThen/* ? */()) { | |||
scope.message(MessageUtil.error(WeaverMessages | |||
.format(WeaverMessages.CALL_DOESNT_SUPPORT_PARAMETERIZED_DECLARING_TYPES), getSourceLocation())); | |||
scope.message(MessageUtil.error( | |||
WeaverMessages.format(WeaverMessages.CALL_DOESNT_SUPPORT_PARAMETERIZED_DECLARING_TYPES), | |||
getSourceLocation())); | |||
} | |||
visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor(); |
@@ -55,31 +55,31 @@ public class SimpleScope implements IScope { | |||
int len = name.length(); | |||
if (len == 3) { | |||
if (name.equals("int")) { | |||
return ResolvedType.INT; | |||
return UnresolvedType.INT; | |||
} | |||
} else if (len == 4) { | |||
if (name.equals("void")) { | |||
return ResolvedType.VOID; | |||
return UnresolvedType.VOID; | |||
} else if (name.equals("byte")) { | |||
return ResolvedType.BYTE; | |||
return UnresolvedType.BYTE; | |||
} else if (name.equals("char")) { | |||
return ResolvedType.CHAR; | |||
return UnresolvedType.CHAR; | |||
} else if (name.equals("long")) { | |||
return ResolvedType.LONG; | |||
return UnresolvedType.LONG; | |||
} | |||
} else if (len == 5) { | |||
if (name.equals("float")) { | |||
return ResolvedType.FLOAT; | |||
return UnresolvedType.FLOAT; | |||
} else if (name.equals("short")) { | |||
return ResolvedType.SHORT; | |||
return UnresolvedType.SHORT; | |||
} | |||
} else if (len == 6) { | |||
if (name.equals("double")) { | |||
return ResolvedType.DOUBLE; | |||
return UnresolvedType.DOUBLE; | |||
} | |||
} else if (len == 7) { | |||
if (name.equals("boolean")) { | |||
return ResolvedType.BOOLEAN; | |||
return UnresolvedType.BOOLEAN; | |||
} | |||
} | |||
} |
@@ -127,8 +127,8 @@ public class ReflectionBasedReferenceTypeDelegateFactory { | |||
public static ResolvedMember createResolvedMethod(Method aMethod, World inWorld) { | |||
ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.METHOD, | |||
toResolvedType(aMethod.getDeclaringClass(), (IReflectionWorld) inWorld), aMethod.getModifiers(), toResolvedType( | |||
aMethod.getReturnType(), (IReflectionWorld) inWorld), aMethod.getName(), toResolvedTypeArray(aMethod | |||
.getParameterTypes(), inWorld), toResolvedTypeArray(aMethod.getExceptionTypes(), inWorld), aMethod); | |||
aMethod.getReturnType(), (IReflectionWorld) inWorld), aMethod.getName(), toResolvedTypeArray( | |||
aMethod.getParameterTypes(), inWorld), toResolvedTypeArray(aMethod.getExceptionTypes(), inWorld), aMethod); | |||
if (inWorld instanceof IReflectionWorld) { | |||
ret.setAnnotationFinder(((IReflectionWorld) inWorld).getAnnotationFinder()); | |||
} | |||
@@ -139,8 +139,8 @@ public class ReflectionBasedReferenceTypeDelegateFactory { | |||
public static ResolvedMember createResolvedAdviceMember(Method aMethod, World inWorld) { | |||
ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.ADVICE, | |||
toResolvedType(aMethod.getDeclaringClass(), (IReflectionWorld) inWorld), aMethod.getModifiers(), toResolvedType( | |||
aMethod.getReturnType(), (IReflectionWorld) inWorld), aMethod.getName(), toResolvedTypeArray(aMethod | |||
.getParameterTypes(), inWorld), toResolvedTypeArray(aMethod.getExceptionTypes(), inWorld), aMethod); | |||
aMethod.getReturnType(), (IReflectionWorld) inWorld), aMethod.getName(), toResolvedTypeArray( | |||
aMethod.getParameterTypes(), inWorld), toResolvedTypeArray(aMethod.getExceptionTypes(), inWorld), aMethod); | |||
if (inWorld instanceof IReflectionWorld) { | |||
ret.setAnnotationFinder(((IReflectionWorld) inWorld).getAnnotationFinder()); | |||
} | |||
@@ -150,7 +150,7 @@ public class ReflectionBasedReferenceTypeDelegateFactory { | |||
public static ResolvedMember createStaticInitMember(Class forType, World inWorld) { | |||
return new ResolvedMemberImpl(org.aspectj.weaver.Member.STATIC_INITIALIZATION, toResolvedType(forType, | |||
(IReflectionWorld) inWorld), Modifier.STATIC, ResolvedType.VOID, "<clinit>", new UnresolvedType[0], | |||
(IReflectionWorld) inWorld), Modifier.STATIC, UnresolvedType.VOID, "<clinit>", new UnresolvedType[0], | |||
new UnresolvedType[0]); | |||
} | |||
@@ -158,9 +158,9 @@ public class ReflectionBasedReferenceTypeDelegateFactory { | |||
ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.CONSTRUCTOR, | |||
toResolvedType(aConstructor.getDeclaringClass(), (IReflectionWorld) inWorld), aConstructor.getModifiers(), | |||
// to return what BCEL returns, the return type for ctor is void | |||
ResolvedType.VOID,// toResolvedType(aConstructor.getDeclaringClass(),(IReflectionWorld)inWorld), | |||
"<init>", toResolvedTypeArray(aConstructor.getParameterTypes(), inWorld), toResolvedTypeArray(aConstructor | |||
.getExceptionTypes(), inWorld), aConstructor); | |||
UnresolvedType.VOID,// toResolvedType(aConstructor.getDeclaringClass(),(IReflectionWorld)inWorld), | |||
"<init>", toResolvedTypeArray(aConstructor.getParameterTypes(), inWorld), toResolvedTypeArray( | |||
aConstructor.getExceptionTypes(), inWorld), aConstructor); | |||
if (inWorld instanceof IReflectionWorld) { | |||
ret.setAnnotationFinder(((IReflectionWorld) inWorld).getAnnotationFinder()); | |||
} |
@@ -29,7 +29,7 @@ import org.aspectj.weaver.tools.MatchingContext; | |||
/** | |||
* @author colyer | |||
* | |||
* | |||
*/ | |||
public class ReflectionShadow extends Shadow { | |||
@@ -47,94 +47,99 @@ public class ReflectionShadow extends Shadow { | |||
private Map withinCodeAnnotationVar = new HashMap(); | |||
private Map annotationVar = new HashMap(); | |||
private AnnotationFinder annotationFinder; | |||
public static Shadow makeExecutionShadow(World inWorld, java.lang.reflect.Member forMethod, MatchingContext withContext) { | |||
Kind kind = (forMethod instanceof Method) ? Shadow.MethodExecution : Shadow.ConstructorExecution; | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forMethod, inWorld); | |||
ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); | |||
return new ReflectionShadow(inWorld,kind,signature,null,enclosingType,null,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); | |||
} | |||
public static Shadow makeAdviceExecutionShadow(World inWorld, java.lang.reflect.Method forMethod, MatchingContext withContext) { | |||
Kind kind = Shadow.AdviceExecution; | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedAdviceMember(forMethod, inWorld); | |||
ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); | |||
return new ReflectionShadow(inWorld,kind,signature,null,enclosingType,null,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); | |||
} | |||
public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, java.lang.reflect.Member withinCode, MatchingContext withContext) { | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld,withinCode,withContext); | |||
public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, java.lang.reflect.Member withinCode, | |||
MatchingContext withContext) { | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld, withinCode, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(aMember, inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(withinCode, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
Kind kind = aMember instanceof Method ? Shadow.MethodCall : Shadow.ConstructorCall; | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, Class thisClass, MatchingContext withContext) { | |||
Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, thisClass,withContext); | |||
public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, Class thisClass, | |||
MatchingContext withContext) { | |||
Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, thisClass, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(aMember, inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(thisClass, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
Kind kind = aMember instanceof Method ? Shadow.MethodCall : Shadow.ConstructorCall; | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public static Shadow makeStaticInitializationShadow(World inWorld, Class forType, MatchingContext withContext) { | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(forType, inWorld); | |||
ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); | |||
Kind kind = Shadow.StaticInitialization; | |||
return new ReflectionShadow(inWorld,kind,signature,null,enclosingType,null,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); | |||
} | |||
public static Shadow makePreInitializationShadow(World inWorld, Constructor forConstructor, MatchingContext withContext) { | |||
Kind kind = Shadow.PreInitialization; | |||
Kind kind = Shadow.PreInitialization; | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forConstructor, inWorld); | |||
ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); | |||
return new ReflectionShadow(inWorld,kind,signature,null,enclosingType,null,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); | |||
} | |||
public static Shadow makeInitializationShadow(World inWorld, Constructor forConstructor, MatchingContext withContext) { | |||
Kind kind = Shadow.Initialization; | |||
Kind kind = Shadow.Initialization; | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forConstructor, inWorld); | |||
ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); | |||
return new ReflectionShadow(inWorld,kind,signature,null,enclosingType,null,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); | |||
} | |||
public static Shadow makeHandlerShadow(World inWorld, Class exceptionType, Class withinType, MatchingContext withContext) { | |||
Kind kind = Shadow.ExceptionHandler; | |||
Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, withinType,withContext); | |||
Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, withinType, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createHandlerMember(exceptionType, withinType, inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(withinType, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public static Shadow makeHandlerShadow(World inWorld, Class exceptionType, java.lang.reflect.Member withinCode, MatchingContext withContext) { | |||
public static Shadow makeHandlerShadow(World inWorld, Class exceptionType, java.lang.reflect.Member withinCode, | |||
MatchingContext withContext) { | |||
Kind kind = Shadow.ExceptionHandler; | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld, withinCode,withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createHandlerMember(exceptionType, withinCode.getDeclaringClass(), inWorld); | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld, withinCode, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createHandlerMember(exceptionType, | |||
withinCode.getDeclaringClass(), inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(withinCode, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public static Shadow makeFieldGetShadow(World inWorld, Field forField, Class callerType, MatchingContext withContext) { | |||
Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, callerType,withContext); | |||
Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, callerType, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedField(forField, inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(callerType, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
Kind kind = Shadow.FieldGet; | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public static Shadow makeFieldGetShadow(World inWorld, Field forField, java.lang.reflect.Member inMember, MatchingContext withContext) { | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld,inMember,withContext); | |||
public static Shadow makeFieldGetShadow(World inWorld, Field forField, java.lang.reflect.Member inMember, | |||
MatchingContext withContext) { | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld, inMember, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedField(forField, inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(inMember, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
Kind kind = Shadow.FieldGet; | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public static Shadow makeFieldSetShadow(World inWorld, Field forField, Class callerType, MatchingContext withContext) { | |||
@@ -143,71 +148,83 @@ public class ReflectionShadow extends Shadow { | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(callerType, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
Kind kind = Shadow.FieldSet; | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public static Shadow makeFieldSetShadow(World inWorld, Field forField, java.lang.reflect.Member inMember, MatchingContext withContext) { | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld,inMember,withContext); | |||
public static Shadow makeFieldSetShadow(World inWorld, Field forField, java.lang.reflect.Member inMember, | |||
MatchingContext withContext) { | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld, inMember, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedField(forField, inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(inMember, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
Kind kind = Shadow.FieldSet; | |||
return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext); | |||
return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
} | |||
public ReflectionShadow(World world, Kind kind, Member signature, Shadow enclosingShadow, ResolvedType enclosingType, ResolvedMember enclosingMember, MatchingContext withContext) { | |||
super(kind,signature,enclosingShadow); | |||
public ReflectionShadow(World world, Kind kind, Member signature, Shadow enclosingShadow, ResolvedType enclosingType, | |||
ResolvedMember enclosingMember, MatchingContext withContext) { | |||
super(kind, signature, enclosingShadow); | |||
this.world = world; | |||
this.enclosingType = enclosingType; | |||
this.enclosingMember = enclosingMember; | |||
this.matchContext = withContext; | |||
if (world instanceof IReflectionWorld) { | |||
this.annotationFinder = ((IReflectionWorld)world).getAnnotationFinder(); | |||
this.annotationFinder = ((IReflectionWorld) world).getAnnotationFinder(); | |||
} | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getIWorld() | |||
*/ | |||
public World getIWorld() { | |||
return world; | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getThisVar() | |||
*/ | |||
public Var getThisVar() { | |||
if (thisVar == null && hasThis()) { | |||
thisVar = ReflectionVar.createThisVar(getThisType().resolve(world),this.annotationFinder); | |||
thisVar = ReflectionVar.createThisVar(getThisType().resolve(world), this.annotationFinder); | |||
} | |||
return thisVar; | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getTargetVar() | |||
*/ | |||
public Var getTargetVar() { | |||
if (targetVar == null && hasTarget()) { | |||
targetVar = ReflectionVar.createTargetVar(getThisType().resolve(world),this.annotationFinder); | |||
targetVar = ReflectionVar.createTargetVar(getThisType().resolve(world), this.annotationFinder); | |||
} | |||
return targetVar; | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getEnclosingType() | |||
*/ | |||
public UnresolvedType getEnclosingType() { | |||
return this.enclosingType; | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getArgVar(int) | |||
*/ | |||
public Var getArgVar(int i) { | |||
if (argsVars == null) { | |||
this.argsVars = new Var[this.getArgCount()]; | |||
for (int j = 0; j < this.argsVars.length; j++) { | |||
this.argsVars[j] = ReflectionVar.createArgsVar(getArgType(j).resolve(world), j,this.annotationFinder); | |||
this.argsVars[j] = ReflectionVar.createArgsVar(getArgType(j).resolve(world), j, this.annotationFinder); | |||
} | |||
} | |||
if (i < argsVars.length) { | |||
@@ -217,122 +234,126 @@ public class ReflectionShadow extends Shadow { | |||
} | |||
} | |||
/* (non-Javadoc) | |||
* @see org.aspectj.weaver.Shadow#getThisJoinPointVar() | |||
*/ | |||
public Var getThisJoinPointVar() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
/* (non-Javadoc) | |||
* @see org.aspectj.weaver.Shadow#getThisJoinPointStaticPartVar() | |||
*/ | |||
public Var getThisJoinPointStaticPartVar() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
/* (non-Javadoc) | |||
* @see org.aspectj.weaver.Shadow#getThisEnclosingJoinPointStaticPartVar() | |||
*/ | |||
public Var getThisEnclosingJoinPointStaticPartVar() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
/* (non-Javadoc) | |||
* @see org.aspectj.weaver.Shadow#getKindedAnnotationVar(org.aspectj.weaver.UnresolvedType) | |||
*/ | |||
public Var getThisAspectInstanceVar(ResolvedType aspectType) { | |||
return null; | |||
} | |||
public Var getKindedAnnotationVar(UnresolvedType forAnnotationType) { | |||
ResolvedType annType = forAnnotationType.resolve(world); | |||
if (annotationVar.get(annType) == null) { | |||
Var v = ReflectionVar.createAtAnnotationVar(annType,this.annotationFinder); | |||
annotationVar.put(annType,v); | |||
Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder); | |||
annotationVar.put(annType, v); | |||
} | |||
return (Var) annotationVar.get(annType); | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getWithinAnnotationVar(org.aspectj.weaver.UnresolvedType) | |||
*/ | |||
public Var getWithinAnnotationVar(UnresolvedType forAnnotationType) { | |||
ResolvedType annType = forAnnotationType.resolve(world); | |||
if (withinAnnotationVar.get(annType) == null) { | |||
Var v = ReflectionVar.createWithinAnnotationVar(annType,this.annotationFinder); | |||
withinAnnotationVar.put(annType,v); | |||
Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder); | |||
withinAnnotationVar.put(annType, v); | |||
} | |||
return (Var) withinAnnotationVar.get(annType); | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getWithinCodeAnnotationVar(org.aspectj.weaver.UnresolvedType) | |||
*/ | |||
public Var getWithinCodeAnnotationVar(UnresolvedType forAnnotationType) { | |||
ResolvedType annType = forAnnotationType.resolve(world); | |||
if (withinCodeAnnotationVar.get(annType) == null) { | |||
Var v = ReflectionVar.createWithinCodeAnnotationVar(annType,this.annotationFinder); | |||
withinCodeAnnotationVar.put(annType,v); | |||
Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder); | |||
withinCodeAnnotationVar.put(annType, v); | |||
} | |||
return (Var) withinCodeAnnotationVar.get(annType); | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getThisAnnotationVar(org.aspectj.weaver.UnresolvedType) | |||
*/ | |||
public Var getThisAnnotationVar(UnresolvedType forAnnotationType) { | |||
if (atThisVar == null) { | |||
atThisVar = ReflectionVar.createThisAnnotationVar(forAnnotationType.resolve(world),this.annotationFinder); | |||
atThisVar = ReflectionVar.createThisAnnotationVar(forAnnotationType.resolve(world), this.annotationFinder); | |||
} | |||
return atThisVar; | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getTargetAnnotationVar(org.aspectj.weaver.UnresolvedType) | |||
*/ | |||
public Var getTargetAnnotationVar(UnresolvedType forAnnotationType) { | |||
if (atTargetVar == null) { | |||
atTargetVar = ReflectionVar.createTargetAnnotationVar(forAnnotationType.resolve(world),this.annotationFinder); | |||
atTargetVar = ReflectionVar.createTargetAnnotationVar(forAnnotationType.resolve(world), this.annotationFinder); | |||
} | |||
return atTargetVar; | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getArgAnnotationVar(int, org.aspectj.weaver.UnresolvedType) | |||
*/ | |||
public Var getArgAnnotationVar(int i, UnresolvedType forAnnotationType) { | |||
ResolvedType annType = forAnnotationType.resolve(world); | |||
if (atArgsVars.get(annType) == null) { | |||
Var[] vars = new Var[getArgCount()]; | |||
atArgsVars.put(annType,vars); | |||
atArgsVars.put(annType, vars); | |||
} | |||
Var[] vars = (Var[]) atArgsVars.get(annType); | |||
if (i > (vars.length - 1) ) return null; | |||
if (i > (vars.length - 1)) | |||
return null; | |||
if (vars[i] == null) { | |||
vars[i] = ReflectionVar.createArgsAnnotationVar(annType, i,this.annotationFinder); | |||
vars[i] = ReflectionVar.createArgsAnnotationVar(annType, i, this.annotationFinder); | |||
} | |||
return vars[i]; | |||
} | |||
/* (non-Javadoc) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getEnclosingCodeSignature() | |||
*/ | |||
public Member getEnclosingCodeSignature() { | |||
// XXX this code is copied from BcelShadow with one minor change... | |||
if (getKind().isEnclosingKind()) { | |||
return getSignature(); | |||
} else if (getKind() == Shadow.PreInitialization) { | |||
// PreInit doesn't enclose code but its signature | |||
// is correctly the signature of the ctor. | |||
return getSignature(); | |||
} else if (enclosingShadow == null) { | |||
return this.enclosingMember; | |||
} else { | |||
return enclosingShadow.getSignature(); | |||
} | |||
} | |||
/* (non-Javadoc) | |||
if (getKind().isEnclosingKind()) { | |||
return getSignature(); | |||
} else if (getKind() == Shadow.PreInitialization) { | |||
// PreInit doesn't enclose code but its signature | |||
// is correctly the signature of the ctor. | |||
return getSignature(); | |||
} else if (enclosingShadow == null) { | |||
return this.enclosingMember; | |||
} else { | |||
return enclosingShadow.getSignature(); | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getSourceLocation() | |||
*/ | |||
public ISourceLocation getSourceLocation() { |
@@ -111,7 +111,7 @@ public class StandardShadow extends Shadow { | |||
Kind kind = Shadow.StaticInitialization; | |||
if (clinit == -1) { | |||
Member clinitMember = new ResolvedMemberImpl(org.aspectj.weaver.Member.STATIC_INITIALIZATION, forType, Modifier.STATIC, | |||
ResolvedType.VOID, "<clinit>", new UnresolvedType[0], new UnresolvedType[0]); | |||
UnresolvedType.VOID, "<clinit>", new UnresolvedType[0], new UnresolvedType[0]); | |||
return new StandardShadow(inWorld, kind, clinitMember, null, forType, null, withContext); | |||
} else { | |||
return new StandardShadow(inWorld, kind, members[clinit], null, forType, null, withContext); | |||
@@ -145,8 +145,8 @@ public class StandardShadow extends Shadow { | |||
MatchingContext withContext) { | |||
Kind kind = Shadow.ExceptionHandler; | |||
Shadow enclosingShadow = makeExecutionShadow(inWorld, withinCode, withContext); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createHandlerMember(exceptionType, withinCode | |||
.getDeclaringClass(), inWorld); | |||
Member signature = ReflectionBasedReferenceTypeDelegateFactory.createHandlerMember(exceptionType, | |||
withinCode.getDeclaringClass(), inWorld); | |||
ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(withinCode, inWorld); | |||
ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld); | |||
return new StandardShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext); | |||
@@ -273,31 +273,18 @@ public class StandardShadow extends Shadow { | |||
return null; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getThisJoinPointStaticPartVar() | |||
*/ | |||
public Var getThisJoinPointStaticPartVar() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getThisEnclosingJoinPointStaticPartVar() | |||
*/ | |||
public Var getThisEnclosingJoinPointStaticPartVar() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see org.aspectj.weaver.Shadow#getKindedAnnotationVar(org.aspectj.weaver.UnresolvedType) | |||
*/ | |||
public Var getThisAspectInstanceVar(ResolvedType aspectType) { | |||
return null; | |||
} | |||
public Var getKindedAnnotationVar(UnresolvedType forAnnotationType) { | |||
ResolvedType annType = forAnnotationType.resolve(world); | |||
if (annotationVar.get(annType) == null) { |