]> source.dussan.org Git - aspectj.git/commitdiff
annoValMatch: implementation
authoraclement <aclement>
Mon, 25 Feb 2008 21:40:59 +0000 (21:40 +0000)
committeraclement <aclement>
Mon, 25 Feb 2008 21:40:59 +0000 (21:40 +0000)
weaver/src/org/aspectj/weaver/AjAttribute.java
weaver/src/org/aspectj/weaver/AnnotatedElement.java
weaver/src/org/aspectj/weaver/AnnotationX.java
weaver/src/org/aspectj/weaver/JoinPointSignature.java
weaver/src/org/aspectj/weaver/MemberImpl.java
weaver/src/org/aspectj/weaver/ResolvedType.java
weaver/src/org/aspectj/weaver/WeaverMessages.java
weaver/src/org/aspectj/weaver/weaver-messages.properties

index f1d68512e3cf4ebb2de35112e49d26a813ea89b8..f338daded27d04d44f35708325d3efe35173c562 100644 (file)
@@ -217,12 +217,13 @@ public abstract class AjAttribute {
                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_AJ160M2 = 5;
                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_AJ160;
+               private static short CURRENT_VERSION_MAJOR      = WEAVER_VERSION_MAJOR_AJ160M2;
                private static short CURRENT_VERSION_MINOR      = WEAVER_VERSION_MINOR_AJ160;
                
                public static final WeaverVersionInfo UNKNOWN = 
index 9c2c54aa4b83e22223923f51fb365edc1740673b..bb65e36f696b8490ea4ade865c2d0790bb657a62 100644 (file)
@@ -16,5 +16,6 @@ public interface AnnotatedElement {
        boolean hasAnnotation(UnresolvedType ofType);
        
        ResolvedType[] getAnnotationTypes();
-       // SomeType getAnnotation(UnresolvedType ofType);
+       
+       AnnotationX getAnnotationOfType(UnresolvedType ofType);
 }
index 66a5eaff0ad7d674445126c2317c47c8aaf9fce5..f673aaa4b66b597b4ce3e1fba065fbacc9d95822 100644 (file)
@@ -206,4 +206,14 @@ public class AnnotationX {
          else                 sb.append(theRealASMAnnotation.stringify());
   }
 
+  public boolean hasNameValuePair(String n, String v) {
+         if (mode==MODE_BCEL) return theRealBcelAnnotation.hasNameValuePair(n,v);
+         else                 throw new RuntimeException("Cannot be anything else");
+  }
+
+  public boolean hasNamedValue(String n) {
+         if (mode==MODE_BCEL) return theRealBcelAnnotation.hasNamedValue(n);
+         else                 throw new RuntimeException("Cannot be anything else");
+  }
+
 }
\ No newline at end of file
index 3c168e67b6edbf33bf39793c36ddfe21db9b368b..e58dfecaf30475f79a7c191f3bd6d6c3372d62f5 100644 (file)
@@ -91,6 +91,10 @@ public class JoinPointSignature implements ResolvedMember {
        public ResolvedType[] getAnnotationTypes() {
                return realMember.getAnnotationTypes();
        }
+       
+       public AnnotationX getAnnotationOfType(UnresolvedType ofType) {
+               return realMember.getAnnotationOfType(ofType);
+       }
 
        public void setAnnotationTypes(UnresolvedType[] annotationtypes) {
                realMember.setAnnotationTypes(annotationtypes);
@@ -419,4 +423,8 @@ public class JoinPointSignature implements ResolvedMember {
        public ResolvedMember parameterizedWith(Map m, World w) {
                return realMember.parameterizedWith(m,w);
        }
+
+       public String getAnnotationDefaultValue() {
+               return realMember.getAnnotationDefaultValue();
+       }
 }
index d984f2e84b072df1144028831f1ac1e4649efbb1..03aba64c27e50426c3b96f9ba102d1d67122ec73 100644 (file)
@@ -486,6 +486,10 @@ public class MemberImpl implements Comparable, AnnotatedElement,Member {
     public ResolvedType[][] getParameterAnnotationTypes() { 
                throw new UnsupportedOperationException("You should resolve this member and call getParameterAnnotationTypes() on the result...");
     }
+    public String getAnnotationDefaultValue() { 
+               throw new UnsupportedOperationException("You should resolve this member and call getAnnotationDefaultValue() on the result...");
+    }
+    
     /* (non-Javadoc)
         * @see org.aspectj.weaver.Member#getSignature()
         */
@@ -628,16 +632,14 @@ public class MemberImpl implements Comparable, AnnotatedElement,Member {
                throw new UnsupportedOperationException("You should resolve this member and call hasAnnotation() on the result...");
        }
        
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.AnnotatedElement#getAnnotationTypes()
-        */
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.Member#getAnnotationTypes()
-        */
        public ResolvedType[] getAnnotationTypes() {
                throw new UnsupportedOperationException("You should resolve this member and call hasAnnotation() on the result...");
        }
-       
+
+    public AnnotationX getAnnotationOfType(UnresolvedType ofType) { 
+               throw new UnsupportedOperationException("You should resolve this member and call getAnnotationOfType() on the result...");
+    }
+    
        /* (non-Javadoc)
         * @see org.aspectj.weaver.Member#getAnnotations()
         */
index 6a01e3ca19141be7962cb1f72de05b4d08a66a5d..6399cb985de6a0b34b41ae80d4a6f1bb320c3063 100644 (file)
@@ -116,6 +116,10 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
        return EMPTY_RESOLVED_TYPE_ARRAY;
     }
     
+    public AnnotationX getAnnotationOfType(UnresolvedType ofType) { 
+       return null;
+    }
+    
     public final UnresolvedType getSuperclass(World world) {
         return getSuperclass();
     }
index d58251c70e9e08c6a3a01adde4ac84d496fe44d9..00b2e1f019b7c7dc59ffe9e843b741c3ef7086c3 100644 (file)
@@ -146,6 +146,10 @@ public class WeaverMessages {
        public static final String INCORRECT_TARGET_FOR_DECLARE_ANNOTATION = "incorrectTargetForDeclareAnnotation";
        public static final String NO_MATCH_BECAUSE_SOURCE_RETENTION = "noMatchBecauseSourceRetention";
        
+       // Annotation Value messages
+       public static final String INVALID_ANNOTATION_VALUE = "invalidAnnotationValue";
+       public static final String UNKNOWN_ANNOTATION_VALUE = "unknownAnnotationValue";
+       
        // < Java5 messages
        public static final String ATANNOTATION_ONLY_SUPPORTED_AT_JAVA5_LEVEL = "atannotationNeedsJava5";
        public static final String ATWITHIN_ONLY_SUPPORTED_AT_JAVA5_LEVEL = "atwithinNeedsJava5";
index af5ab65d2f71bd7beb64da7c5ffcce81154ffa63..77c9b003190e01f0235e0d05f56fc9e645ea7e6d 100644 (file)
@@ -157,6 +157,10 @@ referenceToNonAnnotationType=Type referred to is not an annotation type: {0}
 bindingNonRuntimeRetentionAnnotation=Annotation type {0} does not have runtime retention
 noMatchBecauseSourceRetention=Failing match because annotation ''{0}'' on type ''{1}'' has SOURCE retention.  Matching allowed when RetentionPolicy is CLASS or RUNTIME
 
+# Annotation value
+invalidAnnotationValue=Invalid annotation value ''{0}'', expected {1} value
+unknownAnnotationValue=The annotation ''{0}'' does not define a value named ''{1}''
+
 # Generics
 cantDecpMultipleParameterizations=Cannot declare parent {0} onto type {1} since it already has {2} in its hierarchy
 noParameterizedTypePatternInHandler=a parameterized type pattern may not be used in a handler pointcut expression