aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-06 10:59:34 +0000
committeracolyer <acolyer>2005-09-06 10:59:34 +0000
commit9a7dfa5ff13d55a2934e877a7684944920efc224 (patch)
tree3d7476f414ced6ddb9cbc55ba4204ad0c2c084ff
parentdef2f307c6579a5992191b9364d4c74364baef4b (diff)
downloadaspectj-9a7dfa5ff13d55a2934e877a7684944920efc224.tar.gz
aspectj-9a7dfa5ff13d55a2934e877a7684944920efc224.zip
fix for pr108818, remember the actual declaring type of a member that refers to a pointcut
-rw-r--r--weaver/src/org/aspectj/weaver/Advice.java2
-rw-r--r--weaver/src/org/aspectj/weaver/Checker.java2
-rw-r--r--weaver/src/org/aspectj/weaver/CrosscuttingMembers.java4
-rw-r--r--weaver/src/org/aspectj/weaver/ReferenceType.java10
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedType.java1
-rw-r--r--weaver/src/org/aspectj/weaver/ShadowMunger.java14
6 files changed, 27 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/Advice.java b/weaver/src/org/aspectj/weaver/Advice.java
index 0d47bf424..989b56501 100644
--- a/weaver/src/org/aspectj/weaver/Advice.java
+++ b/weaver/src/org/aspectj/weaver/Advice.java
@@ -270,7 +270,7 @@ public abstract class Advice extends ShadowMunger {
*/
public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
// assert !fromType.isAbstract();
- Pointcut p = pointcut.concretize(fromType, signature.getArity(), this);
+ Pointcut p = pointcut.concretize(fromType, getDeclaringType(), signature.getArity(), this);
if (clause != null) {
Pointcut oldP = p;
p = new AndPointcut(clause, p);
diff --git a/weaver/src/org/aspectj/weaver/Checker.java b/weaver/src/org/aspectj/weaver/Checker.java
index 02678d535..4b035b171 100644
--- a/weaver/src/org/aspectj/weaver/Checker.java
+++ b/weaver/src/org/aspectj/weaver/Checker.java
@@ -32,7 +32,7 @@ public class Checker extends ShadowMunger {
}
public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
- pointcut = pointcut.concretize(fromType, 0, this);
+ pointcut = pointcut.concretize(fromType, getDeclaringType(), 0, this);
return this;
}
diff --git a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
index 85dfd3664..3e74251b3 100644
--- a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
+++ b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
@@ -111,6 +111,7 @@ public class CrosscuttingMembers {
// this is not extensible, oh well
if (declare instanceof DeclareErrorOrWarning) {
ShadowMunger m = new Checker((DeclareErrorOrWarning)declare);
+ m.setDeclaringType(declare.getDeclaringType());
addShadowMunger(m);
} else if (declare instanceof DeclarePrecedence) {
declareDominates.add(declare);
@@ -122,7 +123,8 @@ public class CrosscuttingMembers {
DeclareSoft d = (DeclareSoft)declare;
// Ordered so that during concretization we can check the related munger
ShadowMunger m = Advice.makeSoftener(world, d.getPointcut(), d.getException(),inAspect,d);
- Pointcut concretePointcut = d.getPointcut().concretize(inAspect, 0,m);
+ m.setDeclaringType(d.getDeclaringType());
+ Pointcut concretePointcut = d.getPointcut().concretize(inAspect, d.getDeclaringType(), 0,m);
m.pointcut = concretePointcut;
declareSofts.add(new DeclareSoft(d.getException(), concretePointcut));
addConcreteShadowMunger(m);
diff --git a/weaver/src/org/aspectj/weaver/ReferenceType.java b/weaver/src/org/aspectj/weaver/ReferenceType.java
index 0061e3f99..75d35acb5 100644
--- a/weaver/src/org/aspectj/weaver/ReferenceType.java
+++ b/weaver/src/org/aspectj/weaver/ReferenceType.java
@@ -421,6 +421,7 @@ public class ReferenceType extends ResolvedType {
protected Collection getDeclares() {
if (parameterizedDeclares != null) return parameterizedDeclares;
+ Collection declares = null;
if (isParameterizedType()) {
Collection genericDeclares = delegate.getDeclares();
parameterizedDeclares = new ArrayList();
@@ -429,10 +430,15 @@ public class ReferenceType extends ResolvedType {
Declare declareStatement = (Declare) iter.next();
parameterizedDeclares.add(declareStatement.parameterizeWith(parameterizationMap));
}
- return parameterizedDeclares;
+ declares = parameterizedDeclares;
} else {
- return delegate.getDeclares();
+ declares = delegate.getDeclares();
}
+ for (Iterator iter = declares.iterator(); iter.hasNext();) {
+ Declare d = (Declare) iter.next();
+ d.setDeclaringType(this);
+ }
+ return declares;
}
protected Collection getTypeMungers() { return delegate.getTypeMungers(); }
diff --git a/weaver/src/org/aspectj/weaver/ResolvedType.java b/weaver/src/org/aspectj/weaver/ResolvedType.java
index 73142c23b..b453e1745 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedType.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedType.java
@@ -633,6 +633,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
if (this.isParameterizedType()) {
munger.setPointcut(munger.getPointcut().parameterizeWith(typeVariableMap));
}
+ munger.setDeclaringType(this);
l.add(munger);
}
}
diff --git a/weaver/src/org/aspectj/weaver/ShadowMunger.java b/weaver/src/org/aspectj/weaver/ShadowMunger.java
index 8a8d2bf67..0d7e74925 100644
--- a/weaver/src/org/aspectj/weaver/ShadowMunger.java
+++ b/weaver/src/org/aspectj/weaver/ShadowMunger.java
@@ -41,6 +41,7 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
protected ISourceContext sourceContext;
private ISourceLocation sourceLocation;
private String handle = null;
+ private ResolvedType declaringType; // the type that declared this munger.
public ShadowMunger(Pointcut pointcut, int start, int end, ISourceContext sourceContext) {
@@ -112,7 +113,18 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
this.pointcut = pointcut;
}
-
+ /**
+ * Invoked when the shadow munger of a resolved type are processed.
+ * @param aType
+ */
+ public void setDeclaringType(ResolvedType aType) {
+ this.declaringType = aType;
+ }
+
+ public ResolvedType getDeclaringType() {
+ return this.declaringType;
+ }
+
/**
* @return a Collection of ResolvedType for all checked exceptions that
* might be thrown by this munger