[jboss-cvs] container/src/main/org/jboss/reflect/plugins ...

Kabir Khan kkhan at jboss.com
Tue Jul 18 07:23:49 EDT 2006


  User: kkhan   
  Date: 06/07/18 07:23:49

  Modified:    src/main/org/jboss/reflect/plugins  
                        InheritableAnnotationHolder.java
                        AnnotationValueFactory.java
  Log:
  Move annotation creator into container from aop module
  
  Use jboss retro to create a JDK 1.4 dist and test under JDK 1,4.
  
  Revision  Changes    Path
  1.14      +5 -1      container/src/main/org/jboss/reflect/plugins/InheritableAnnotationHolder.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: InheritableAnnotationHolder.java
  ===================================================================
  RCS file: /cvsroot/jboss/container/src/main/org/jboss/reflect/plugins/InheritableAnnotationHolder.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- InheritableAnnotationHolder.java	23 Jun 2006 10:07:21 -0000	1.13
  +++ InheritableAnnotationHolder.java	18 Jul 2006 11:23:49 -0000	1.14
  @@ -22,6 +22,7 @@
   package org.jboss.reflect.plugins;
   
   import java.io.Serializable;
  +import java.lang.annotation.Inherited;
   import java.util.Collections;
   import java.util.HashMap;
   import java.util.Map;
  @@ -41,6 +42,9 @@
      /** serialVersionUID */
      private static final long serialVersionUID = 3257290210164289843L;
      
  +   /** The classname of the <code>@Inherited</code> annotation, this needs retroing to work on JDK 1.4 */
  +   private static final String INHERITED_NAME = Inherited.class.getName();//This 
  +   
      /** Unknown annotations map */
      static final Map<String, AnnotationValue> UNKNOWN_ANNOTATIONS_MAP = Collections.unmodifiableMap(new HashMap<String, AnnotationValue>());
      
  @@ -143,7 +147,7 @@
               for (int i = 0; i < superAllAnnotations.length; i++)
               {
                  AnnotationValue av = superAllAnnotations[i];
  -               if (av.getAnnotationType().isAnnotationPresent("java.lang.annotation.Inherited"))
  +               if (av.getAnnotationType().isAnnotationPresent(INHERITED_NAME))
                  {
                     allAnnotations.put(av.getAnnotationType().getName(), av);
                  }
  
  
  
  1.5       +2 -8      container/src/main/org/jboss/reflect/plugins/AnnotationValueFactory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AnnotationValueFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/container/src/main/org/jboss/reflect/plugins/AnnotationValueFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- AnnotationValueFactory.java	23 Jun 2006 10:07:21 -0000	1.4
  +++ AnnotationValueFactory.java	18 Jul 2006 11:23:49 -0000	1.5
  @@ -41,7 +41,7 @@
   /**
    * 
    * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class AnnotationValueFactory 
   {
  @@ -86,13 +86,7 @@
      public static AnnotationValue createAnnotationValue(TypeInfoFactory typeInfoFactory, AnnotationHelper annotationHelper, AnnotationInfo info, Object ann)
      {
         Annotation annotation = (Annotation)ann;
  -      //Class clazz = annotation.annotationType();//Throwa an execption: no default value: org.jboss.test.classinfo.support.ValueAnnotation.annotationType()
  -      Class[] interfaces = annotation.getClass().getInterfaces();
  -      if (interfaces.length != 1)
  -      {
  -         throw new RuntimeException("Annotation should implement exactly one interface " + annotation);
  -      }
  -      Class clazz = interfaces[0];
  +      Class clazz = annotation.annotationType();
         
         Method[] methods = getDeclaredMethods(clazz);
         
  
  
  



More information about the jboss-cvs-commits mailing list