} 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) {
} 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;
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];
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) {
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
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
// 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;
}
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;
}
} 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",
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());
}
/**
}
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);
// 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) {
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) {
}
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())) {
}
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");
}
* 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;
}
* 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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());
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;
}
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));
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);
}
}
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);
}
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);
}
/**
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());
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);
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.
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) {
@Override
public ResolvedType resolve(World world) {
+ if (this.world != world) {
+ throw new IllegalStateException();
+ }
this.world = world;
return super.resolve(world);
}
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) {
// 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;
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;
+ }
}
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;
}
public abstract Var getThisEnclosingJoinPointStaticPartVar();
+ public abstract Var getThisAspectInstanceVar(ResolvedType aspectType);
+
// annotation variables
public abstract Var getKindedAnnotationVar(UnresolvedType forAnnotationType);
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();
}
// 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) {
/** 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);
}
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
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
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);
}
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@";
* 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:
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.
*
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 '+':
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;
}
}
+ 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>");
- }
}
/**
}
// ==========================================================================
- // ===
// 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
}
public static void reset() {
- ResolvedType.resetPrimitives();
+ // ResolvedType.resetPrimitives();
}
/**
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);
}
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");
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();
public boolean isErroneousVar(int formalIndex) {
return erroneousVars[formalIndex];
}
+
+ public void setConcreteAspect(ResolvedType concreteAspect) {
+ this.concreteAspect = concreteAspect;
+ }
+
+ public ResolvedType getConcreteAspect() {
+ return this.concreteAspect;
+ }
}
}
Test ret = Literal.TRUE;
- List args = new ArrayList();
+ List<Var> args = new ArrayList<Var>();
// code style
if (extraParameterFlags >= 0) {
// 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);
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;
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
}
}
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())));
}
}
}
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() });
}
}
// 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()));
}
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();
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();
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;
}
}
}
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());
}
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());
}
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]);
}
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());
}
/**
* @author colyer
- *
+ *
*/
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) {
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) {
}
}
- /* (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() {
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);
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);
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) {