diff options
author | aclement <aclement> | 2008-08-22 17:09:15 +0000 |
---|---|---|
committer | aclement <aclement> | 2008-08-22 17:09:15 +0000 |
commit | 2473e588ca5e55c3c703d6a67f33e1f99283ff45 (patch) | |
tree | cc064df42d49b21f2539a0a849d4d601913d3199 /weaver | |
parent | 71c23eac9f0575692fea14ed4a2cdaff36b7d1bc (diff) | |
download | aspectj-2473e588ca5e55c3c703d6a67f33e1f99283ff45.tar.gz aspectj-2473e588ca5e55c3c703d6a67f33e1f99283ff45.zip |
197720: test and fix: annotation matching on parameterized member
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java index 6f516887f..1a0a52d8a 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java @@ -285,12 +285,28 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno return (annotationTypes!=null); } + /** + * Check if this member has an annotation of the specified type. If the member has a backing generic + * member then this member represents a parameterization of a member in a generic type and the annotations + * available on the backing generic member should be used. + * + * @param ofType the type of the annotation being searched for + * @return true if the annotation is found on this member or its backing generic member + */ public boolean hasAnnotation(UnresolvedType ofType) { // The ctors don't allow annotations to be specified ... yet - but // that doesn't mean it is an error to call this method. // Normally the weaver will be working with subtypes of // this type - BcelField/BcelMethod - if (annotationTypes==null) return false; + if (backingGenericMember!=null) { + if (annotationTypes!=null) { + throw new BCException("Unexpectedly found a backing generic member and a local set of annotations"); + } + return backingGenericMember.hasAnnotation(ofType); + } + if (annotationTypes==null) { + return false; + } return annotationTypes.contains(ofType); } |