public static ResolvedMember privilegedAccessMethodForFieldGet(TypeX aspectType, Member field) {
String sig;
if (field.isStatic()) {
- sig = "()" + field.getSignature();
+ sig = "()" + field.getReturnType().getSignature();
} else {
- sig = "(" + field.getDeclaringType().getSignature() + ")" + field.getSignature();
+ sig = "(" + field.getDeclaringType().getSignature() + ")" + field.getReturnType().getSignature();
}
return new ResolvedMember(Member.METHOD,
public static ResolvedMember privilegedAccessMethodForFieldSet(TypeX aspectType, Member field) {
String sig;
if (field.isStatic()) {
- sig = "(" + field.getSignature() + ")V";
+ sig = "(" + field.getReturnType().getSignature() + ")V";
} else {
- sig = "(" + field.getDeclaringType().getSignature() + field.getSignature() + ")V";
+ sig = "(" + field.getDeclaringType().getSignature() + field.getReturnType().getSignature() + ")V";
}
return new ResolvedMember(Member.METHOD,
public ResolvedMember getMatchingSyntheticMember(Member member, ResolvedTypeX aspectType) {
//??? might give a field where a method is expected
+ ResolvedTypeX onType = aspectType.getWorld().resolve(getSignature().getDeclaringType());
+
ResolvedMember ret = AjcMemberMaker.interFieldGetDispatcher(getSignature(), aspectType);
if (ResolvedTypeX.matches(ret, member)) return getSignature();
ret = AjcMemberMaker.interFieldSetDispatcher(getSignature(), aspectType);
if (ResolvedTypeX.matches(ret, member)) return getSignature();
+ ret = AjcMemberMaker.interFieldInterfaceGetter(getSignature(), onType, aspectType);
+ if (ResolvedTypeX.matches(ret, member)) return getSignature();
+ ret = AjcMemberMaker.interFieldInterfaceSetter(getSignature(), onType, aspectType);
+ if (ResolvedTypeX.matches(ret, member)) return getSignature();
return super.getMatchingSyntheticMember(member, aspectType);
}
}
return getSignature();
}
+ public ResolvedMember getMatchingSyntheticMember(Member member, ResolvedTypeX aspectType) {
+ ResolvedMember ret;
+ if (getSignature().getKind() == Member.FIELD) {
+ ret = AjcMemberMaker.privilegedAccessMethodForFieldGet(aspectType, getSignature());
+ if (ResolvedTypeX.matches(ret, member)) return getSignature();
+ ret = AjcMemberMaker.privilegedAccessMethodForFieldSet(aspectType, getSignature());
+ if (ResolvedTypeX.matches(ret, member)) return getSignature();
+ } else {
+ //System.err.println("sig: " + getSignature());
+ ret = AjcMemberMaker.privilegedAccessMethodForMethod(aspectType, getSignature());
+ if (ResolvedTypeX.matches(ret, member)) return getSignature();
+ }
+ return null;
+ }
+
}
}
if (kind.isCflow()) {
- if (this.innerCflowEntries.contains(o)) return -1;
- else if (o.innerCflowEntries.contains(this)) return +1;
+// System.err.println("sort: " + this + " innerCflowEntries " + innerCflowEntries);
+// System.err.println(" " + o + " innerCflowEntries " + o.innerCflowEntries);
+ boolean isBelow = (kind == AdviceKind.CflowBelowEntry);
+
+ if (this.innerCflowEntries.contains(o)) return isBelow ? +1 : -1;
+ else if (o.innerCflowEntries.contains(this)) return isBelow ? -1 : +1;
else return 0;
}
Member method =
world.makeMethodSignature(clazz, invoke);
ResolvedMember declaredSig = method.resolve(world);
+ //System.err.println(method + ", declaredSig: " +declaredSig);
if (declaredSig == null) return;
- AjAttribute.EffectiveSignatureAttribute effectiveSig = declaredSig.getEffectiveSignature();
- if (effectiveSig == null) return;
- //System.err.println("call to inter-type member: " + effectiveSig);
- if (effectiveSig.isWeaveBody()) return;
- match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow,
+ if (declaredSig.getKind() == Member.FIELD) {
+ Shadow.Kind kind;
+ if (method.getReturnType().equals(ResolvedTypeX.VOID)) {
+ kind = Shadow.FieldSet;
+ } else {
+ kind = Shadow.FieldGet;
+ }
+
+ match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow,
+ kind, declaredSig),
+ shadowAccumulator);
+ } else {
+ AjAttribute.EffectiveSignatureAttribute effectiveSig = declaredSig.getEffectiveSignature();
+ if (effectiveSig == null) return;
+ //System.err.println("call to inter-type member: " + effectiveSig);
+ if (effectiveSig.isWeaveBody()) return;
+ match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow,
effectiveSig.getShadowKind(), effectiveSig.getEffectiveSignature()),
shadowAccumulator);
+ }
} else {
match(
BcelShadow.makeMethodCall(world, mg, ih, enclosingShadow),