summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2009-08-13 17:29:13 +0000
committeraclement <aclement>2009-08-13 17:29:13 +0000
commit64f0ff99ca52e37298666b1ef7f8d5ef0bc8caa4 (patch)
tree0f98443e0bc13895faeab5b684de36b1eeabfff6
parent06809533402a29b4e9a657e43a971970cefe9ab0 (diff)
downloadaspectj-64f0ff99ca52e37298666b1ef7f8d5ef0bc8caa4.tar.gz
aspectj-64f0ff99ca52e37298666b1ef7f8d5ef0bc8caa4.zip
286539: test and fix (decanno type in model)
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java34
1 files changed, 29 insertions, 5 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java
index 9757bbdae..668d7ebaa 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java
@@ -42,6 +42,7 @@ public class DeclareAnnotation extends Declare {
private String annotationString = "@<annotation>";
private ResolvedType containingAspect;
private AnnotationAJ annotation;
+ private ResolvedType annotationType;
/**
* Captures type of declare annotation (method/type/field/constructor)
@@ -309,7 +310,13 @@ public class DeclareAnnotation extends Declare {
// if weaving broken code, this can happen
return;
}
- annotation = annos[0];
+ int idx = 0;
+ if (annos.length > 0
+ && annos[0].getType().getSignature().equals("Lorg/aspectj/internal/lang/annotation/ajcDeclareAnnotation;")) {
+ idx = 1;
+ }
+ annotation = annos[idx];
+ break;
}
}
}
@@ -351,11 +358,28 @@ public class DeclareAnnotation extends Declare {
}
/**
- * @return UnresolvedType for the annotation
+ * @return the type of the annotation
*/
- public UnresolvedType getAnnotationTypeX() {
- ensureAnnotationDiscovered();
- return (this.annotation == null ? null : this.annotation.getType());
+ public ResolvedType getAnnotationType() {
+ if (annotationType == null) {
+ for (Iterator iter = containingAspect.getMethods(); iter.hasNext();) {
+ ResolvedMember member = (ResolvedMember) iter.next();
+ if (member.getName().equals(annotationMethod)) {
+ ResolvedType[] annoTypes = member.getAnnotationTypes();
+ if (annoTypes == null) {
+ // if weaving broken code, this can happen
+ return null;
+ }
+ int idx = 0;
+ if (annoTypes[0].getSignature().equals("Lorg/aspectj/internal/lang/annotation/ajcDeclareAnnotation;")) {
+ idx = 1;
+ }
+ annotationType = annoTypes[idx];
+ break;
+ }
+ }
+ }
+ return annotationType;
}
/**