summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-11-21 15:54:49 +0000
committeraclement <aclement>2005-11-21 15:54:49 +0000
commitd10d611c2ffcfe98285e89052c72887d2f148a14 (patch)
tree9da778420dee875f1b595eacf00669ed5bb17b0b
parent6c48b83e22e125d99f8a8fa0e201482ce3d1650d (diff)
downloadaspectj-d10d611c2ffcfe98285e89052c72887d2f148a14.tar.gz
aspectj-d10d611c2ffcfe98285e89052c72887d2f148a14.zip
pr115250: changed parameterizeWith() signature for shadowmungers.
-rw-r--r--weaver/src/org/aspectj/weaver/Checker.java2
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedType.java2
-rw-r--r--weaver/src/org/aspectj/weaver/ShadowMunger.java2
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java22
4 files changed, 22 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/Checker.java b/weaver/src/org/aspectj/weaver/Checker.java
index c064c2610..f123ad36d 100644
--- a/weaver/src/org/aspectj/weaver/Checker.java
+++ b/weaver/src/org/aspectj/weaver/Checker.java
@@ -48,7 +48,7 @@ public class Checker extends ShadowMunger {
throw new RuntimeException("illegal state");
}
- public ShadowMunger parameterizeWith(Map typeVariableMap) {
+ public ShadowMunger parameterizeWith(ResolvedType declaringType,Map typeVariableMap) {
Checker ret = new Checker(
getPointcut().parameterizeWith(typeVariableMap),
getStart(),
diff --git a/weaver/src/org/aspectj/weaver/ResolvedType.java b/weaver/src/org/aspectj/weaver/ResolvedType.java
index a590b7440..1c3f5a637 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedType.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedType.java
@@ -684,7 +684,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
if (munger != null) {
if (this.isParameterizedType()) {
//munger.setPointcut(munger.getPointcut().parameterizeWith(typeVariableMap));
- munger = munger.parameterizeWith(typeVariableMap);
+ munger = munger.parameterizeWith(this,typeVariableMap);
if (munger instanceof Advice) {
Advice advice = (Advice) munger;
// update to use the parameterized signature...
diff --git a/weaver/src/org/aspectj/weaver/ShadowMunger.java b/weaver/src/org/aspectj/weaver/ShadowMunger.java
index 3ff34bd8d..3204a9625 100644
--- a/weaver/src/org/aspectj/weaver/ShadowMunger.java
+++ b/weaver/src/org/aspectj/weaver/ShadowMunger.java
@@ -64,7 +64,7 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
return pointcut.match(shadow).maybeTrue();
}
- public abstract ShadowMunger parameterizeWith(Map typeVariableMap);
+ public abstract ShadowMunger parameterizeWith(ResolvedType declaringType,Map typeVariableMap);
public int fallbackCompareTo(Object other) {
return toString().compareTo(toString());
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
index f8618e303..a27e3270a 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
@@ -87,9 +87,16 @@ public class BcelAdvice extends Advice {
return ret;
}
- public ShadowMunger parameterizeWith(Map typeVariableMap) {
+ public ShadowMunger parameterizeWith(ResolvedType declaringType,Map typeVariableMap) {
Pointcut pc = getPointcut().parameterizeWith(typeVariableMap);
- BcelAdvice ret = new BcelAdvice(this.attribute,pc,this.signature,this.concreteAspect);
+
+ BcelAdvice ret = null;
+ Member adviceSignature = signature;
+ // allows for around advice where the return value is a type variable (see pr115250)
+ if (signature instanceof ResolvedMember) {
+ adviceSignature = ((ResolvedMember)signature).parameterizedWith(declaringType.getTypeParameters(),declaringType,declaringType.isParameterizedType());
+ }
+ ret = new BcelAdvice(this.attribute,pc,adviceSignature,this.concreteAspect);
return ret;
}
@@ -503,7 +510,16 @@ public class BcelAdvice extends Advice {
public InstructionList getNonTestAdviceInstructions(BcelShadow shadow) {
return new InstructionList(
- Utility.createInvoke(shadow.getFactory(), shadow.getWorld(), getSignature()));
+ Utility.createInvoke(shadow.getFactory(), shadow.getWorld(), getOriginalSignature()));
+ }
+
+ public Member getOriginalSignature() {
+ Member sig = getSignature();
+ if (sig instanceof ResolvedMember) {
+ ResolvedMember rsig = (ResolvedMember)sig;
+ if (rsig.hasBackingGenericMember()) return rsig.getBackingGenericMember();
+ }
+ return sig;
}
public InstructionList getTestInstructions(