[jboss-cvs] JBossAS SVN: r70836 - in projects/aop/trunk/aop/src/main/org/jboss/aop: annotation and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 13 15:04:34 EDT 2008


Author: kabir.khan at jboss.com
Date: 2008-03-13 15:04:33 -0400 (Thu, 13 Mar 2008)
New Revision: 70836

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructionInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructorInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/FieldInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java
Log:
Tidyup, add generics and get rid of warnings

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -23,6 +23,7 @@
 
 import gnu.trove.TLongObjectHashMap;
 
+import java.lang.annotation.Annotation;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -342,18 +343,18 @@
       return annotations;
    }
 
-   public Object resolveAnnotation(Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Class<T> annotation)
    {
       if (metadata != null)
       {
-         Object value = metadata.getAnnotation(annotation);
+         T value = metadata.getAnnotation(annotation);
          if (value != null) return value;
       }
 
       if (annotations.isDisabled(annotation))
          return null;
 
-      Object value = annotations.resolveClassAnnotation(annotation);
+      T value = annotations.resolveClassAnnotation(annotation);
       if (clazz == null) return null;
       if (value == null && metadata == null)
       {
@@ -372,12 +373,12 @@
       return hasAnnotation(tgt, annotation, null);
    }
 
-   public boolean hasAnnotation(Class<?> tgt, Class annotation)
+   public boolean hasAnnotation(Class<?> tgt, Class<? extends Annotation> annotation)
    {
       return hasAnnotation(tgt, null, annotation);
    }
 
-   private boolean hasAnnotation(Class<?> tgt, String annotation, Class annotationClass)
+   private boolean hasAnnotation(Class<?> tgt, String annotation, Class<? extends Annotation> annotationClass)
    {
       if (annotation == null && annotationClass == null)
       {
@@ -410,12 +411,12 @@
       return false;
    }
 
-   public Object resolveAnnotation(Method m, Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Method m, Class<T> annotation)
    {
       return resolveAnnotation(0, m, annotation);
    }
 
-   public Object resolveAnnotation(long hash, Method m, Class annotation)
+   public <T extends Annotation> T resolveAnnotation(long hash, Method m, Class<T> annotation)
    {
       if (metadata != null)
       {
@@ -423,7 +424,7 @@
          MetaData methodMD = metadata.getComponentMetaData(signature);
          if (methodMD != null)
          {
-            Object val = methodMD.getAnnotation(annotation);
+            T val = methodMD.getAnnotation(annotation);
             if (val != null) return val;
          }
       }
@@ -431,7 +432,7 @@
       if (annotations.isDisabled(m,annotation))
          return null;
 
-      Object value = annotations.resolveAnnotation(m, annotation);
+      T value = annotations.resolveAnnotation(m, annotation);
       if (value == null && metadata == null) 
       {
          value = AnnotationElement.getVisibleAnnotation(m, annotation);
@@ -439,19 +440,19 @@
       return value;
    }
 
-   public Object resolveAnnotation(Method m, Class[] annotationChoices)
+   public <T extends Annotation> T resolveAnnotation(Method m, Class<T>[] annotationChoices)
    {
-      for (Class ann : annotationChoices)
+      for (Class<T> ann : annotationChoices)
       {
-         Object val = resolveAnnotation(m, annotationChoices);
+         T val = resolveAnnotation(m, ann);
          if (val != null) return val;
       }
       return null;
    }
 
-   public Object resolveAnnotation(Field f, Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Field f, Class<T> annotation)
    {
-      Object value = null;
+      T value = null;
       if (metadata != null)
       {
          FieldSignature signature = new FieldSignature(f);
@@ -471,9 +472,9 @@
       return value;
    }
 
-   public Object resolveAnnotation(Constructor<?> c, Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Constructor<?> c, Class<T> annotation)
    {
-      Object value = null;
+      T value = null;
       if (metadata != null)
       {
          ConstructorSignature signature = new ConstructorSignature(c);
@@ -498,12 +499,12 @@
       return hasAnnotation(0, m, annotation, null);
    }
 
-   public boolean hasAnnotation(Method m, Class annotation)
+   public boolean hasAnnotation(Method m, Class<? extends Annotation> annotation)
    {
       return hasAnnotation(0, m, null, annotation);
    }
 
-   private boolean hasAnnotation(long hash, Method m, String annotation, Class annotationClass)
+   private boolean hasAnnotation(long hash, Method m, String annotation, Class<? extends Annotation> annotationClass)
    {
       if (annotation == null && annotationClass == null)
       {

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructionInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructionInfo.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructionInfo.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -21,6 +21,7 @@
   */
 package org.jboss.aop;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 
 import org.jboss.aop.joinpoint.ConstructorJoinpoint;
@@ -108,9 +109,9 @@
       return index;
    }
 
-   public Object resolveAnnotation(Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Class<T> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      T val = super.resolveAnnotation(annotation);
       if (val != null) return val;
 
       if (getAdvisor() != null)

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructorInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructorInfo.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructorInfo.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -21,6 +21,7 @@
   */
 package org.jboss.aop;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 
@@ -119,9 +120,9 @@
    }
    
 
-   public Object resolveAnnotation(Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Class<T> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      T val = super.resolveAnnotation(annotation);
       if (val != null) return val;
 
       if (getAdvisor() != null)

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/FieldInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/FieldInfo.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/FieldInfo.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -21,6 +21,7 @@
   */
 package org.jboss.aop;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.security.AccessController;
@@ -155,9 +156,9 @@
       return read;
    }
 
-   public Object resolveAnnotation(Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Class<T> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      T val = super.resolveAnnotation(annotation);
       if (val != null) return val;
 
       if (getAdvisor() != null)

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -21,6 +21,7 @@
   */
 package org.jboss.aop;
 
+import java.lang.annotation.Annotation;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -184,7 +185,7 @@
       return getAdvisor().getClassMetaData().getMetaData(key, attr);
    }
    
-   public Object resolveClassAnnotation(Class annotation)
+   public <T extends Annotation> T resolveClassAnnotation(Class<T> annotation)
    {
       Advisor advisor = getAdvisor();
       if (advisor != null)
@@ -194,7 +195,7 @@
       return null;
    }
    
-   public Object resolveAnnotation(Class annotation)
+   public <T extends Annotation> T  resolveAnnotation(Class<T> annotation)
    {
       return null;
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInfo.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInfo.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -26,6 +26,7 @@
 import org.jboss.aop.joinpoint.MethodJoinpoint;
 import org.jboss.aop.util.MethodHashing;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 
 /**
@@ -122,9 +123,9 @@
       return sb.toString();
    }
 
-   public Object resolveAnnotation(Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Class<T> annotation)
    {
-      Object val = super.resolveAnnotation(annotation);
+      T val = super.resolveAnnotation(annotation);
       if (val != null)
       {
          return val;

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationElement.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -42,6 +42,7 @@
  */
 public class AnnotationElement extends PortableAnnotationElement
 {
+   private final static Annotation[] EMPTY_ANNOTATIONS = new Annotation[0];
    /**
     * Get a visible annotation for a particle Method.  If this is JDK 1.5
     * then this is a wrapper for Method.getAnnotation
@@ -50,7 +51,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Method method, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Method method, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -70,7 +71,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Constructor con, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -90,7 +91,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Field field, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Field field, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -110,7 +111,7 @@
     * @param annotation
     * @return
     */
-   public static Object getVisibleAnnotation(Class clazz, Class annotation)
+   public static <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, Class<T> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -122,7 +123,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Class clazz, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -134,7 +135,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Method m, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Method m, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -146,7 +147,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Field f, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Field f, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -158,7 +159,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Constructor con, Class annotation)
+   public static boolean isVisibleAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -170,7 +171,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Class clazz, String annotation)
+   public static boolean isVisibleAnnotationPresent(Class<?> clazz, String annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -206,7 +207,7 @@
       }
    }
 
-   public static boolean isVisibleAnnotationPresent(Constructor con, String annotation)
+   public static boolean isVisibleAnnotationPresent(Constructor<?> con, String annotation)
    {
       if (System.getSecurityManager() == null)
       {
@@ -218,7 +219,7 @@
       }
    }
 
-   public static Annotation[] getVisibleAnnotations(Class clazz) throws Exception
+   public static Annotation[] getVisibleAnnotations(Class<?> clazz) throws Exception
    {
       if (System.getSecurityManager() == null)
       {
@@ -254,7 +255,7 @@
       }
    }
    
-   public static Annotation[] getVisibleAnnotations(Constructor c) throws Exception
+   public static Annotation[] getVisibleAnnotations(Constructor<?> c) throws Exception
    {
       if (System.getSecurityManager() == null)
       {
@@ -269,128 +270,128 @@
    
    private interface AnnotationElementAction
    {
-      Annotation getVisibleAnnotation(Method method, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Method method, Class<T> annotation);
 
-      Annotation getVisibleAnnotation(Constructor con, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, Class<T> annotation);
 
-      Annotation getVisibleAnnotation(Field field, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Field field, Class<T> annotation);
 
-      Annotation getVisibleAnnotation(Class clazz, Class annotation);
+      <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, Class<T> annotation);
       
-      Annotation getVisibleAnnotation(Method method, String annotation);
+      <T extends Annotation> T getVisibleAnnotation(Method method, String annotation);
 
-      Annotation getVisibleAnnotation(Constructor con, String annotation);
+      <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, String annotation);
 
-      Annotation getVisibleAnnotation(Field field, String annotation);
+      <T extends Annotation> T getVisibleAnnotation(Field field, String annotation);
 
-      Annotation getVisibleAnnotation(Class clazz, String annotation);
+      <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, String annotation);
 
-      boolean isVisibleAnnotationPresent(Class clazz, Class annotation);
+      boolean isVisibleAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation);
 
-      boolean isVisibleAnnotationPresent(Method m, Class annotation);
+      boolean isVisibleAnnotationPresent(Method m, Class<? extends Annotation> annotation);
 
-      boolean isVisibleAnnotationPresent(Field f, Class annotation);
+      boolean isVisibleAnnotationPresent(Field f, Class<? extends Annotation> annotation);
 
-      boolean isVisibleAnnotationPresent(Constructor con, Class annotation);
+      boolean isVisibleAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation);
       
-      boolean isVisibleAnnotationPresent(Class clazz, String annotation);
+      boolean isVisibleAnnotationPresent(Class<?> clazz, String annotation);
 
       boolean isVisibleAnnotationPresent(Method m, String annotation);
 
       boolean isVisibleAnnotationPresent(Field f, String annotation);
 
-      boolean isVisibleAnnotationPresent(Constructor con, String annotation);
+      boolean isVisibleAnnotationPresent(Constructor<?> con, String annotation);
 
-      Annotation[] getVisibleAnnotations(Class clazz) throws Exception;
+      <T extends Annotation> T[] getVisibleAnnotations(Class<?> clazz) throws Exception;
 
-      Annotation[] getVisibleAnnotations(Method m) throws Exception;
+      <T extends Annotation> T[] getVisibleAnnotations(Method m) throws Exception;
       
-      Annotation[] getVisibleAnnotations(Field f) throws Exception;
+      <T extends Annotation> T[] getVisibleAnnotations(Field f) throws Exception;
       
-      Annotation[] getVisibleAnnotations(Constructor c) throws Exception;
+      <T extends Annotation> T[] getVisibleAnnotations(Constructor<?> c) throws Exception;
       
       AnnotationElementAction NON_PRIVILEGED = new AnnotationElementAction()
       {
-         public Annotation getVisibleAnnotation(Method method, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Method method, Class<T> annotation)
          {
             return method.getAnnotation(annotation);
          }
 
-         public Annotation getVisibleAnnotation(Constructor con, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Constructor<?> con, Class<T> annotation)
          {
             return con.getAnnotation(annotation);
          }
 
-         public Annotation getVisibleAnnotation(Field field, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Field field, Class<T> annotation)
          {
             return field.getAnnotation(annotation);
          }
 
-         public Annotation getVisibleAnnotation(Class clazz, Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, Class<T> annotation)
          {
             return clazz.getAnnotation(annotation);
          }
-         public Annotation getVisibleAnnotation(Method method, String annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Method method, String annotation)
          {
             for(Annotation a : getVisibleAnnotations(method))
             {
                 if(a.annotationType().getName().equals(annotation))
-                  return a;
+                  return (T)a;
             }
             return null;
          }
 
-         public Annotation getVisibleAnnotation(Constructor con, String annotation)
+         public <T extends Annotation> T  getVisibleAnnotation(Constructor<?> con, String annotation)
          {
             for(Annotation a : getVisibleAnnotations(con))
             {
                 if(a.annotationType().getName().equals(annotation))
-                  return a;
+                  return (T)a;
             }
             return null;
          }
 
-         public Annotation getVisibleAnnotation(Field field, String annotation)
+         public <T extends Annotation> T  getVisibleAnnotation(Field field, String annotation)
          {
             for(Annotation a : getVisibleAnnotations(field))
             {
                 if(a.annotationType().getName().equals(annotation))
-                  return a;
+                  return (T)a;
             }
             return null;
          }
 
-         public Annotation getVisibleAnnotation(Class clazz, String annotation)
+         public <T extends Annotation> T getVisibleAnnotation(Class<?> clazz, String annotation)
          {
             for(Annotation a : getVisibleAnnotations(clazz))
             {
                 if(a.annotationType().getName().equals(annotation))
-                  return a;
+                  return (T)a;
             }
             return null;
          }
 
-         public boolean isVisibleAnnotationPresent(Class clazz, Class annotation)
+         public boolean isVisibleAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation)
          {
             return clazz.isAnnotationPresent(annotation);
          }
 
-         public boolean isVisibleAnnotationPresent(Method m, Class annotation)
+         public boolean isVisibleAnnotationPresent(Method m, Class<? extends Annotation> annotation)
          {
             return m.isAnnotationPresent(annotation);
          }
 
-         public boolean isVisibleAnnotationPresent(Field f, Class annotation)
+         public boolean isVisibleAnnotationPresent(Field f, Class<? extends Annotation> annotation)
          {
             return f.isAnnotationPresent(annotation);
          }
 
-         public boolean isVisibleAnnotationPresent(Constructor con, Class annotation)
+         public boolean isVisibleAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation)
          {
             return con.isAnnotationPresent(annotation);
          }
          
-         public boolean isVisibleAnnotationPresent(Class clazz, String annotation)
+         public boolean isVisibleAnnotationPresent(Class<?> clazz, String annotation)
          {
             for(Annotation a : getVisibleAnnotations(clazz))
             {
@@ -420,7 +421,7 @@
             return false;
          }
 
-         public boolean isVisibleAnnotationPresent(Constructor con, String annotation)
+         public boolean isVisibleAnnotationPresent(Constructor<?> con, String annotation)
          {
             for(Annotation a : getVisibleAnnotations(con))
             {
@@ -430,137 +431,137 @@
             return false;
          }
 
-         public Annotation[] getVisibleAnnotations(Class clazz)
+         public <T extends Annotation> T[] getVisibleAnnotations(Class<?> clazz)
          {
-            return clazz.getAnnotations();
+            return (T[])clazz.getAnnotations();
          }
 
-         public Annotation[] getVisibleAnnotations(Method m)
+         public <T extends Annotation> T[] getVisibleAnnotations(Method m)
          {
             if (m.getName().startsWith("access$") && !ReflectUtils.isNotAccessMethod(m))
             {
-               return new Annotation[0];
+               return (T[]) EMPTY_ANNOTATIONS;
             }
-            return m.getAnnotations();
+            return (T[])m.getAnnotations();
          }
          
-         public Annotation[] getVisibleAnnotations(Field f)
+         public <T extends Annotation> T[] getVisibleAnnotations(Field f)
          {
-            return f.getAnnotations();
+            return (T[])f.getAnnotations();
          }
          
-         public Annotation[] getVisibleAnnotations(Constructor c)
+         public <T extends Annotation> T[] getVisibleAnnotations(Constructor<?> c)
          {
-            return c.getAnnotations();
+            return (T[])c.getAnnotations();
          }
       };
       
 
       AnnotationElementAction PRIVILEGED = new AnnotationElementAction()
       {
-         public Annotation getVisibleAnnotation(final Method method, final Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Method method, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return method.getAnnotation(annotation);
                }
             });
          }
 
-         public Annotation getVisibleAnnotation(final Constructor con, final Class annotation)
+         public <T extends Annotation> T  getVisibleAnnotation(final Constructor<?> con, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return con.getAnnotation(annotation);
                }
             });
          }
 
-         public Annotation getVisibleAnnotation(final Field field, final Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Field field, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return field.getAnnotation(annotation);
                }
             });
          }
 
-         public Annotation getVisibleAnnotation(final Class clazz, final Class annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Class<?> clazz, final Class<T> annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   return clazz.getAnnotation(annotation);
                }
             });
          }
 
-         public Annotation getVisibleAnnotation(final Method method, final String annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Method method, final String annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   for(Annotation a : method.getAnnotations())
                   {
                       if(a.annotationType().getName().equals(annotation))
-                        return a;
+                        return (T)a;
                   }
                   return null;
                }
             });
          }
 
-         public Annotation getVisibleAnnotation(final Constructor con, final String annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Constructor<?> con, final String annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   for(Annotation a : con.getAnnotations())
                   {
                       if(a.annotationType().getName().equals(annotation))
-                        return a;
+                        return (T)a;
                   }
                   return null;
                }
             });
          }
 
-         public Annotation getVisibleAnnotation(final Field field, final String annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Field field, final String annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   for(Annotation a : field.getAnnotations())
                   {
                       if(a.annotationType().getName().equals(annotation))
-                        return a;
+                        return (T)a;
                   }
                   return null;
                }
             });
          }
 
-         public Annotation getVisibleAnnotation(final Class clazz, final String annotation)
+         public <T extends Annotation> T getVisibleAnnotation(final Class<?> clazz, final String annotation)
          {
-            return AccessController.doPrivileged(new PrivilegedAction<Annotation>(){
-               public Annotation run()
+            return AccessController.doPrivileged(new PrivilegedAction<T>(){
+               public T run()
                {
                   for(Annotation a : clazz.getAnnotations())
                   {
                       if(a.annotationType().getName().equals(annotation))
-                        return a;
+                        return (T)a;
                   }
                   return null;
                }
             });
          }
          
-         public boolean isVisibleAnnotationPresent(final Class clazz, final Class annotation)
+         public boolean isVisibleAnnotationPresent(final Class<?> clazz, final Class<? extends Annotation> annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   return clazz.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
@@ -570,9 +571,9 @@
             return present.booleanValue();
          }
 
-         public boolean isVisibleAnnotationPresent(final Method m, final Class annotation)
+         public boolean isVisibleAnnotationPresent(final Method m, final Class<? extends Annotation> annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   return m.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
@@ -582,9 +583,9 @@
             return present.booleanValue();
          }
 
-         public boolean isVisibleAnnotationPresent(final Field f, final Class annotation)
+         public boolean isVisibleAnnotationPresent(final Field f, final Class<? extends Annotation> annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   return f.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
@@ -593,9 +594,9 @@
             return present;
          }
 
-         public boolean isVisibleAnnotationPresent(final Constructor con, final Class annotation)
+         public boolean isVisibleAnnotationPresent(final Constructor<?> con, final Class<? extends Annotation> annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   return con.isAnnotationPresent(annotation) ? Boolean.TRUE : Boolean.FALSE;
@@ -605,9 +606,9 @@
          }
 
 
-         public boolean isVisibleAnnotationPresent(final Class clazz, final String annotation)
+         public boolean isVisibleAnnotationPresent(final Class<?> clazz, final String annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   for(Annotation a : clazz.getAnnotations())
@@ -624,7 +625,7 @@
 
          public boolean isVisibleAnnotationPresent(final Method m, final String annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   for(Annotation a : m.getAnnotations())
@@ -641,7 +642,7 @@
 
          public boolean isVisibleAnnotationPresent(final Field f, final String annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   for(Annotation a : f.getAnnotations())
@@ -655,9 +656,9 @@
             return present;
          }
 
-         public boolean isVisibleAnnotationPresent(final Constructor con, final String annotation)
+         public boolean isVisibleAnnotationPresent(final Constructor<?> con, final String annotation)
          {
-            Boolean present = (Boolean)AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
+            Boolean present = AccessController.doPrivileged(new PrivilegedAction<Boolean>(){
                public Boolean run()
                {
                   for(Annotation a : con.getAnnotations())
@@ -671,15 +672,15 @@
             return present;
          }
 
-         public Annotation[] getVisibleAnnotations(final Class clazz) throws Exception 
+         public <T extends Annotation> T[] getVisibleAnnotations(final Class<?> clazz) throws Exception 
          {
             try
             {
-               return AccessController.doPrivileged(new PrivilegedExceptionAction<Annotation[]>()
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>()
                {
-                  public Annotation[] run() throws Exception
+                  public T[] run() throws Exception
                   {
-                     return clazz.getAnnotations();
+                     return (T[])clazz.getAnnotations();
                   }
                });
             }
@@ -689,18 +690,18 @@
             }
          }
 
-         public Annotation[] getVisibleAnnotations(final Method m) throws Exception 
+         public <T extends Annotation> T[] getVisibleAnnotations(final Method m) throws Exception 
          {
             try
             {
-               return AccessController.doPrivileged(new PrivilegedExceptionAction<Annotation[]>(){
-                  public Annotation[] run() throws Exception
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>(){
+                  public T[] run() throws Exception
                   {
                      if (m.getName().startsWith("access$") && !ReflectUtils.isNotAccessMethod(m))
                      {
-                        return new Annotation[0];
+                        return (T[])EMPTY_ANNOTATIONS;
                      }
-                     return m.getAnnotations();
+                     return (T[])m.getAnnotations();
                   }
                });
             }
@@ -710,14 +711,14 @@
             }
          }
          
-         public Annotation[] getVisibleAnnotations(final Field f) throws Exception
+         public <T extends Annotation> T[] getVisibleAnnotations(final Field f) throws Exception
          {
             try
             {
-               return AccessController.doPrivileged(new PrivilegedExceptionAction<Annotation[]>(){
-                  public Annotation[] run() throws Exception
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>(){
+                  public T[] run() throws Exception
                   {
-                     return f.getAnnotations();
+                     return (T[])f.getAnnotations();
                   }
                });
             }
@@ -727,14 +728,14 @@
             }
          }
          
-         public Annotation[] getVisibleAnnotations(final Constructor c) throws Exception
+         public <T extends Annotation> T[] getVisibleAnnotations(final Constructor<?> c) throws Exception
          {
             try
             {
-               return AccessController.doPrivileged(new PrivilegedExceptionAction<Annotation[]>(){
-                  public Annotation[] run() throws Exception
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<T[]>(){
+                  public T[] run() throws Exception
                   {
-                     return c.getAnnotations();
+                     return (T[])c.getAnnotations();
                   }
                });
             }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/AnnotationRepository.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -21,16 +21,13 @@
   */
 package org.jboss.aop.annotation;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Member;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.jboss.annotation.factory.AnnotationCreator;
 import org.jboss.aop.util.UnmodifiableEmptyCollections;
@@ -45,21 +42,22 @@
  */
 public class AnnotationRepository
 {
-   private static final String CLASS_ANNOTATION = "CLASS";
+//   private static final String CLASS_ANNOTATION = "CLASS";
    
    /** Read/Write lock to be used when lazy creating the collections */
    protected Object lazyCollectionLock = new Object();
 
-   volatile Map annotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
-   volatile Map classAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
-   volatile Map disabledAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
+   volatile Map<Object, Map<String, Object>> annotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
+   volatile Map<String, Object> classAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP; 
+   volatile Map<Member, List<String>> disabledAnnotations = UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP;
+   volatile List<String> disabledClassAnnotations = UnmodifiableEmptyCollections.EMPTY_ARRAYLIST;
    
-   public Map getAnnotations()
+   public Map<Object, Map<String, Object>> getAnnotations()
    {
 	   return annotations;
    }
    
-   public Map getClassAnnotations()
+   public Map<String, Object> getClassAnnotations()
    {
 	   return classAnnotations;
    }
@@ -70,37 +68,37 @@
       classAnnotations.put(annotation, value);
    }
 
-   public void addClassAnnotation(Class annotation, Object value)
+   public <T extends Annotation> void addClassAnnotation(Class<T> annotation, T value)
    {
       initClassAnnotationsMap();
       classAnnotations.put(annotation.getName(), value);
    }
 
-   public Object resolveClassAnnotation(Class annotation)
+   public <T extends Annotation> T resolveClassAnnotation(Class<T> annotation)
    {
       Object value = classAnnotations.get(annotation.getName());
       boolean reinsert = value instanceof String;
-      value = extractAnnotation(value, annotation);
+      T ann = extractAnnotation(value, annotation);
       if (reinsert)
       {
-         classAnnotations.put(annotation.getName(), value);
+         classAnnotations.put(annotation.getName(), ann);
       }
-      return value;
+      return ann;
    }
 
-   public Object resolveAnnotation(Member m, Class annotation)
+   public <T extends Annotation> T resolveAnnotation(Member m, Class<T> annotation)
    {
       Object value = resolveAnnotation(m, annotation.getName());
       boolean reinsert = value instanceof String;
-      value = extractAnnotation(value, annotation);
+      T ann = extractAnnotation(value, annotation);
       if (reinsert)
       {
          addAnnotation(m, annotation, value);
       }
-      return value;
+      return ann;
    }
 
-   protected Object extractAnnotation(Object value, Class annotation)
+   protected <T extends Annotation> T  extractAnnotation(Object value, Class<T> annotation)
    {
       if (value == null) return null;
       if (value instanceof String)
@@ -108,19 +106,19 @@
          String expr = (String) value;
          try
          {
-            return AnnotationCreator.createAnnotation(expr, annotation);
+            return (T)AnnotationCreator.createAnnotation(expr, annotation);
          }
          catch (Exception e)
          {
             throw new RuntimeException("Bad annotation expression " + expr, e);
          }
       }
-      return value;
+      return (T)value;
    }
 
    protected Object resolveAnnotation(Member m, String annotation)
    {
-      Map map = (Map) annotations.get(m);
+      Map<String, Object> map = annotations.get(m);
       if (map != null)
       {
          return map.get(annotation);
@@ -130,10 +128,10 @@
    
    public void disableAnnotation(Member m, String annotation)
    {
-      List annotationList = (List)disabledAnnotations.get(m);
+      List<String> annotationList = disabledAnnotations.get(m);
       if (annotationList == null)
       {
-         annotationList = new ArrayList();
+         annotationList = new ArrayList<String>();
          initDisabledAnnotationsMap();
          disabledAnnotations.put(m,annotationList);
       }
@@ -142,74 +140,62 @@
    
    public void disableAnnotation(String annotation)
    {
-      List annotationList = (List)disabledAnnotations.get(CLASS_ANNOTATION);
-      if (annotationList == null)
-      {
-         annotationList = new ArrayList();
-         initDisabledAnnotationsMap();
-         disabledAnnotations.put(CLASS_ANNOTATION,annotationList);
-      }
-      annotationList.add(annotation);
+      initDisabledClassAnnotationsList();
+      disabledClassAnnotations.add(annotation);
    }
    
    public void enableAnnotation(String annotation)
    {
-      List annotationList = (List)disabledAnnotations.get(CLASS_ANNOTATION);
-      if (annotationList != null)
-      {
-         annotationList.remove(annotation);
-      }
-      
+      disabledClassAnnotations.remove(annotation);
    }
    
-   public boolean isDisabled(Member m, Class annotation)
+   public boolean isDisabled(Member m, Class<? extends Annotation> annotation)
    {
       return isDisabled(m,annotation.getName());
    }
    
    public boolean isDisabled(Member m, String annotation)
    {
-      List overrideList = (List)disabledAnnotations.get(m);
-      if (overrideList != null)
+      List<String> overrideList = disabledAnnotations.get(m);
+      if (overrideList != null && overrideList.size() > 0)
       {
-         Iterator overrides = overrideList.iterator();
-         while (overrides.hasNext())
+         for (String override : overrideList)
          {
-            String override = (String)overrides.next();
             if (override.equals(annotation))
+            {
                return true;
+            }
          }
       }
       return false;
    }
    
-   public boolean isDisabled(Class annotation)
+   public boolean isDisabled(Class<? extends Annotation> annotation)
    {
       return isDisabled(annotation.getName());
    }
    
    public boolean isDisabled(String annotation)
    {
-      List overrideList = (List)disabledAnnotations.get(CLASS_ANNOTATION);
-      if (overrideList != null)
+      if (disabledClassAnnotations.size() > 0)
       {
-         Iterator overrides = overrideList.iterator();
-         while (overrides.hasNext())
+         for (String ann : disabledClassAnnotations)
          {
-            String override = (String)overrides.next();
-            if (override.equals(annotation))
+            if (ann.equals(annotation))
+            {
                return true;
+            }
          }
       }
       return false;
    }
 
-   public void addAnnotation(Member m, Class annotation, Object value)
+   public void addAnnotation(Member m, Class<? extends Annotation> annotation, Object value)
    {
-      Map map = (Map) annotations.get(m);
+      Map<String, Object> map = annotations.get(m);
       if (map == null)
       {
-         map = new HashMap();
+         map = new HashMap<String, Object>();
          initAnnotationsMap();
          annotations.put(m, map);
       }
@@ -218,10 +204,10 @@
 
    public void addAnnotation(Member m, String annotation, Object value)
    {
-      Map map = (Map) annotations.get(m);
+      Map<String, Object> map = annotations.get(m);
       if (map == null)
       {
-         map = new HashMap();
+         map = new HashMap<String, Object>();
          initAnnotationsMap();
          annotations.put(m, map);
       }
@@ -233,12 +219,12 @@
       return classAnnotations.containsKey(annotation);
    }
 
-   public boolean hasClassAnnotation(Class annotation)
+   public boolean hasClassAnnotation(Class<? extends Annotation> annotation)
    {
       return classAnnotations.containsKey(annotation.getName());
    }
 
-   public boolean hasAnnotation(Member m, Class annotation)
+   public boolean hasAnnotation(Member m, Class<? extends Annotation> annotation)
    {
       return resolveAnnotation(m, annotation.getName()) != null;
    }
@@ -250,21 +236,21 @@
 
    public boolean hasAnnotation(CtMember m, String annotation)
    {
-      Set set = (Set) annotations.get(m);
-      if (set != null) return set.contains(annotation);
+      Map<String, Object> map = annotations.get(m);
+      if (map != null) return map.containsKey(annotation);
       return false;
    }
 
    public void addAnnotation(CtMember m, String annotation)
    {
-      Set set = (Set) annotations.get(m);
-      if (set == null)
+      Map<String, Object> map = annotations.get(m);
+      if (map == null)
       {
-         set = new HashSet();
+         map = new HashMap<String, Object>();
          initAnnotationsMap();
-         annotations.put(m, set);
+         annotations.put(m, map);
       }
-      set.add(annotation);
+      map.put(annotation, annotation);
    }
 
    protected void initAnnotationsMap()
@@ -275,7 +261,7 @@
          {
             if (annotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
             {
-               annotations = new ConcurrentHashMap();;
+               annotations = new ConcurrentHashMap<Object, Map<String, Object>>();;
             }
          }
       }
@@ -289,7 +275,7 @@
          {
             if (classAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
             {
-               classAnnotations = new ConcurrentHashMap();;
+               classAnnotations = new ConcurrentHashMap<String, Object>();;
             }
          }
       }
@@ -303,9 +289,23 @@
          {
             if (disabledAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
             {
-               disabledAnnotations = new ConcurrentHashMap();;
+               disabledAnnotations = new ConcurrentHashMap<Member, List<String>>();;
             }
          }
       }
    }
+
+   protected void initDisabledClassAnnotationsList()
+   {
+      if (disabledClassAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
+      {
+         synchronized(lazyCollectionLock)
+         {
+            if (disabledClassAnnotations == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
+            {
+               disabledClassAnnotations = new ArrayList<String>();;
+            }
+         }
+      }
+   }
 }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -36,6 +36,7 @@
 import org.jboss.annotation.factory.javassist.AnnotationProxy;
 import org.jboss.aop.util.ReflectToJavassist;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -218,7 +219,7 @@
       
    }
 
-   public static boolean isInvisibleAnnotationPresent(Constructor con, String annotation) throws Exception
+   public static boolean isInvisibleAnnotationPresent(Constructor<?> con, String annotation) throws Exception
    {
       if (closingDownManager)
       {
@@ -267,7 +268,7 @@
       return visible.getAnnotation(annotation) != null;
    }
 
-   public static boolean isAnyAnnotationPresent(Constructor con, String annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Constructor<?> con, String annotation) throws Exception
    {
       if (closingDownManager)
       {
@@ -311,7 +312,7 @@
          return false;
    }
 
-   public static boolean isInvisibleAnnotationPresent(Class clazz, String annotation) throws Exception
+   public static boolean isInvisibleAnnotationPresent(Class<?> clazz, String annotation) throws Exception
    {
       if (closingDownManager)
       {
@@ -373,11 +374,11 @@
       catch (RuntimeException e)
       {
          String name = (clazz != null) ? clazz.getName() : null;
-         throw new RuntimeException("Error looking for " + annotation + " in " + clazz.getName(), e);
+         throw new RuntimeException("Error looking for " + annotation + " in " + name, e);
       }
    }
 
-   public static boolean isAnyAnnotationPresent(Class clazz, String annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Class<?> clazz, String annotation) throws Exception
    {
       if (closingDownManager)
       {
@@ -408,7 +409,7 @@
          return false;
    }
 
-   protected static ClassFile getClassFile(Class clazz) throws NotFoundException
+   protected static ClassFile getClassFile(Class<?> clazz) throws NotFoundException
    {
       ClassPool pool = AspectManager.instance().findClassPool(clazz.getClassLoader());
       CtClass ct = pool.get(clazz.getName());
@@ -416,7 +417,7 @@
       return cf;
    }
 
-   protected static Object create(AnnotationsAttribute group, Class annotation) throws Exception
+   protected static Object create(AnnotationsAttribute group, Class<? extends Annotation> annotation) throws Exception
    {
       if (group == null) return null;
       javassist.bytecode.annotation.Annotation info = group.getAnnotation(annotation.getName());
@@ -424,7 +425,7 @@
       return AnnotationProxy.createProxy(info, annotation);
    }
 
-   public static Object getInvisibleAnnotation(Method method, Class annotation)
+   public static Object getInvisibleAnnotation(Method method, Class<? extends Annotation> annotation)
    {
       if (closingDownManager)
       {
@@ -456,7 +457,7 @@
          return false;
    }
 
-   public static Object getInvisibleAnnotation(Constructor con, Class annotation)
+   public static Object getInvisibleAnnotation(Constructor<?> con, Class<? extends Annotation> annotation)
    {
       if (closingDownManager)
       {
@@ -484,7 +485,7 @@
          return false;
    }
 
-   public static Object getInvisibleAnnotation(Field field, Class annotation)
+   public static Object getInvisibleAnnotation(Field field, Class<? extends Annotation> annotation)
    {
       if (closingDownManager)
       {
@@ -507,7 +508,7 @@
       }
    }
 
-   public static Object getInvisibleAnnotation(Class clazz, Class annotation)
+   public static Object getInvisibleAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
    {
       if (closingDownManager)
       {
@@ -536,7 +537,7 @@
     * @param annotation
     * @return
     */
-   public static Object getAnyAnnotation(Method method, Class annotation)
+   public static Object getAnyAnnotation(Method method, Class<? extends Annotation> annotation)
    {
       Object rtn = AnnotationElement.getVisibleAnnotation(method, annotation);
       if (rtn != null) return rtn;
@@ -553,7 +554,7 @@
     * @param annotation
     * @return
     */
-   public static Object getAnyAnnotation(Constructor con, Class annotation)
+   public static Object getAnyAnnotation(Constructor<?> con, Class<? extends Annotation> annotation)
    {
       Object rtn = AnnotationElement.getVisibleAnnotation(con, annotation);
       if (rtn != null) return rtn;
@@ -563,7 +564,7 @@
          return null;
    }
 
-   public static Object getAnyAnnotation(Field field, Class annotation)
+   public static Object getAnyAnnotation(Field field, Class<? extends Annotation> annotation)
    {
       Object rtn = AnnotationElement.getVisibleAnnotation(field, annotation);
       if (rtn != null) return rtn;
@@ -573,7 +574,7 @@
          return null;
    }
 
-   public static Object getAnyAnnotation(Class clazz, Class annotation)
+   public static Object getAnyAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
    {
       if (clazz == Void.TYPE) return null;
       Object rtn = AnnotationElement.getVisibleAnnotation(clazz, annotation);
@@ -584,7 +585,7 @@
          return null;
    }
 
-   public static boolean isAnyAnnotationPresent(Field field, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Field field, Class<? extends Annotation> annotation) throws Exception
    {
       if (AnnotationElement.isVisibleAnnotationPresent(field, annotation)) 
          return true;
@@ -601,7 +602,7 @@
          return false;
    }
 
-   public static boolean isAnyAnnotationPresent(Class clazz, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation) throws Exception
    {
       if (clazz == Void.TYPE) return false;
       if (AnnotationElement.isVisibleAnnotationPresent(clazz, annotation)) 
@@ -623,7 +624,7 @@
          return false;
    }
 
-   public static boolean isAnyAnnotationPresent(Constructor con, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Constructor<?> con, Class<? extends Annotation> annotation) throws Exception
    {
       if (AnnotationElement.isVisibleAnnotationPresent(con, annotation)) 
          return true;
@@ -640,7 +641,7 @@
          return false;
    }
 
-   public static boolean isAnyAnnotationPresent(Method method, Class annotation) throws Exception
+   public static boolean isAnyAnnotationPresent(Method method, Class<? extends Annotation> annotation) throws Exception
    {
       if (AnnotationElement.isVisibleAnnotationPresent(method, annotation)) 
          return true;
@@ -663,7 +664,7 @@
          return false;
    }
    
-   protected static boolean includeInvisibleAnnotation(Class annotation)
+   protected static boolean includeInvisibleAnnotation(Class<? extends Annotation> annotation)
    {
       return  includeInvisibleAnnotation(annotation.getPackage().getName());
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java	2008-03-13 19:01:45 UTC (rev 70835)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/joinpoint/JoinPointBean.java	2008-03-13 19:04:33 UTC (rev 70836)
@@ -21,6 +21,8 @@
  */
 package org.jboss.aop.joinpoint;
 
+import java.lang.annotation.Annotation;
+
 import org.jboss.aop.Advisor;
 
 /**
@@ -39,7 +41,7 @@
    /**
     * Gets the advisor's class
     */
-   Class getClazz();
+   Class<?> getClazz();
 
    /**
     * Resolves metadata on the class
@@ -49,11 +51,11 @@
    /**
     * Resolves annotations for the class
     */
-   Object resolveClassAnnotation(Class annotation);
+   <T extends Annotation> T resolveClassAnnotation(Class<T> annotation);
 
    /**
     * Resolves annotations on the particular joinpoint (field, constructor, method etc.)
     */
-   Object resolveAnnotation(Class annotation);
+   <T extends Annotation> T resolveAnnotation(Class<T> annotation);
 
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list