From 895ba89d0a948a5717209f4a2731194b7c73d751 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 25 Jan 2008 18:59:49 +0000 Subject: [PATCH] paramannos: implementation! --- weaver/src/org/aspectj/weaver/AjAttribute.java | 9 +++++++-- .../src/org/aspectj/weaver/JoinPointSignature.java | 8 ++++++++ weaver/src/org/aspectj/weaver/Member.java | 7 ++++++- weaver/src/org/aspectj/weaver/MemberImpl.java | 7 +++++++ .../src/org/aspectj/weaver/ResolvedMemberImpl.java | 12 ++++++++++++ 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/AjAttribute.java b/weaver/src/org/aspectj/weaver/AjAttribute.java index a1fc5fcc4..f1d68512e 100644 --- a/weaver/src/org/aspectj/weaver/AjAttribute.java +++ b/weaver/src/org/aspectj/weaver/AjAttribute.java @@ -215,10 +215,15 @@ public abstract class AjAttribute { public static short WEAVER_VERSION_MAJOR_AJ150M4 = 3; public static short WEAVER_VERSION_MAJOR_AJ150 = 2; public static short WEAVER_VERSION_MINOR_AJ150 = 0; + + // These are the weaver major/minor numbers for AspectJ 1.6.0 + public static short WEAVER_VERSION_MAJOR_AJ160 = 4; + public static short WEAVER_VERSION_MINOR_AJ160 = 0; + // These are the weaver major/minor versions for *this* weaver - private static short CURRENT_VERSION_MAJOR = WEAVER_VERSION_MAJOR_AJ150M4; - private static short CURRENT_VERSION_MINOR = WEAVER_VERSION_MINOR_AJ150; + private static short CURRENT_VERSION_MAJOR = WEAVER_VERSION_MAJOR_AJ160; + private static short CURRENT_VERSION_MINOR = WEAVER_VERSION_MINOR_AJ160; public static final WeaverVersionInfo UNKNOWN = new WeaverVersionInfo(WEAVER_VERSION_MAJOR_UNKNOWN,WEAVER_VERSION_MINOR_UNKNOWN); diff --git a/weaver/src/org/aspectj/weaver/JoinPointSignature.java b/weaver/src/org/aspectj/weaver/JoinPointSignature.java index 57752d232..3c168e67b 100644 --- a/weaver/src/org/aspectj/weaver/JoinPointSignature.java +++ b/weaver/src/org/aspectj/weaver/JoinPointSignature.java @@ -263,6 +263,14 @@ public class JoinPointSignature implements ResolvedMember { public UnresolvedType[] getParameterTypes() { return realMember.getParameterTypes(); } + + public AnnotationX[][] getParameterAnnotations() { + return realMember.getParameterAnnotations(); + } + + public ResolvedType[][] getParameterAnnotationTypes() { + return realMember.getParameterAnnotationTypes(); + } public String getSignature() { return realMember.getSignature(); diff --git a/weaver/src/org/aspectj/weaver/Member.java b/weaver/src/org/aspectj/weaver/Member.java index 2b4d9d6d7..f59ae646f 100644 --- a/weaver/src/org/aspectj/weaver/Member.java +++ b/weaver/src/org/aspectj/weaver/Member.java @@ -53,7 +53,9 @@ public interface Member { public static final Kind MONITORENTER = new Kind("MONITORENTER", 8); public static final Kind MONITOREXIT = new Kind("MONITOREXIT", 9); - + public static final AnnotationX[][] NO_PARAMETER_ANNOTATIONXS = new AnnotationX[][]{}; + public static final ResolvedType[][] NO_PARAMETER_ANNOTATION_TYPES = new ResolvedType[][]{}; + public ResolvedMember resolve(World world); public int compareTo(Object other); @@ -75,6 +77,9 @@ public interface Member { public UnresolvedType[] getParameterTypes(); + public AnnotationX[][] getParameterAnnotations(); + public ResolvedType[][] getParameterAnnotationTypes(); + /** * Return full signature, including return type, e.g. "()LFastCar;" for a signature without the return type, * use getParameterSignature() - it is importnant to choose the right one in the face of covariance. diff --git a/weaver/src/org/aspectj/weaver/MemberImpl.java b/weaver/src/org/aspectj/weaver/MemberImpl.java index 65050638c..d984f2e84 100644 --- a/weaver/src/org/aspectj/weaver/MemberImpl.java +++ b/weaver/src/org/aspectj/weaver/MemberImpl.java @@ -479,6 +479,13 @@ public class MemberImpl implements Comparable, AnnotatedElement,Member { * @see org.aspectj.weaver.Member#getParameterTypes() */ public UnresolvedType[] getParameterTypes() { return parameterTypes; } + + public AnnotationX[][] getParameterAnnotations() { + throw new UnsupportedOperationException("You should resolve this member and call getParameterAnnotations() on the result..."); + } + public ResolvedType[][] getParameterAnnotationTypes() { + throw new UnsupportedOperationException("You should resolve this member and call getParameterAnnotationTypes() on the result..."); + } /* (non-Javadoc) * @see org.aspectj.weaver.Member#getSignature() */ diff --git a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java index 8401fa4c8..039d9f5c5 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java @@ -42,6 +42,8 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno protected ResolvedMember backingGenericMember = null; protected Set annotationTypes = null; + protected ResolvedType[][] parameterAnnotationTypes = null; + // Some members are 'created' to represent other things (for example ITDs). These // members have their annotations stored elsewhere, and this flag indicates that is // the case. It is up to the caller to work out where that is! @@ -314,6 +316,16 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno } } + public ResolvedType[][] getParameterAnnotationTypes() { + if (parameterAnnotationTypes == null) return null; + return parameterAnnotationTypes; + } + + public AnnotationX[][] getParameterAnnotations() { + if (backingGenericMember != null) return backingGenericMember.getParameterAnnotations(); + return super.getParameterAnnotations(); + } + public void addAnnotation(AnnotationX annotation) { // FIXME asc only allows for annotation types, not instances - should it? if (annotationTypes == null) annotationTypes = new HashSet(); -- 2.39.5