summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2006-03-29 11:41:39 +0000
committeraclement <aclement>2006-03-29 11:41:39 +0000
commite05ab26570eeb1776836d67e980c37e0813e30e3 (patch)
tree2df8a29d1e469caf0f5aaaf7591dd42bb0dc4ee8 /weaver
parent09406a36994865a841d9b40dff734975dd75f4d2 (diff)
downloadaspectj-e05ab26570eeb1776836d67e980c37e0813e30e3.tar.gz
aspectj-e05ab26570eeb1776836d67e980c37e0813e30e3.zip
test and fix for @DeclareParents problem where the target was "@Coloured *" - fix was to resolve the typepattern
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
index d542571b6..397e8951c 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
+++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
@@ -55,10 +55,10 @@ import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.patterns.AndPointcut;
+import org.aspectj.weaver.patterns.Bindings;
import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
import org.aspectj.weaver.patterns.DeclareParents;
import org.aspectj.weaver.patterns.DeclarePrecedence;
-import org.aspectj.weaver.patterns.ExactTypePattern;
import org.aspectj.weaver.patterns.FormalBinding;
import org.aspectj.weaver.patterns.IScope;
import org.aspectj.weaver.patterns.IdentityPointcutVisitor;
@@ -668,22 +668,20 @@ public class AtAjAttributes {
TypePattern typePattern = parseTypePattern(decpPattern, struct);
ResolvedType fieldType = UnresolvedType.forSignature(struct.field.getSignature()).resolve(struct.enclosingType.getWorld());
if (fieldType.isInterface()) {
- TypePattern parent = new ExactTypePattern(UnresolvedType.forSignature(struct.field.getSignature()), false, false);
- parent.resolve(struct.enclosingType.getWorld());
+ TypePattern parent = parseTypePattern(fieldType.getName(),struct);
+ FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+ IScope binding = new BindingScope(struct.enclosingType,struct.context,bindings);
// first add the declare implements like
List parents = new ArrayList(1); parents.add(parent);
- DeclareParents dp = new DeclareParents(
- typePattern,
- parents,
- false
- );
+ DeclareParents dp = new DeclareParents(typePattern,parents,false);
+ dp.resolve(binding); // resolves the parent and child parts of the decp
+
+ // resolve this so that we can use it for the MethodDelegateMungers below.
+ // eg. '@Coloured *' will change from a WildTypePattern to an 'AnyWithAnnotationTypePattern' after this resolution
+ typePattern = typePattern.resolveBindings(binding, Bindings.NONE, false, false);
//TODO kick ISourceLocation sl = struct.bField.getSourceLocation(); ??
dp.setLocation(struct.context,0,0); // not ideal...
- struct.ajAttributes.add(
- new AjAttribute.DeclareAttribute(
- dp
- )
- );
+ struct.ajAttributes.add(new AjAttribute.DeclareAttribute(dp));
// do we have a defaultImpl=xxx.class (ie implementation)