[jboss-cvs] JBossAS SVN: r70817 - in projects/aop/trunk/aop/src/main/org/jboss/aop: instrument and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 13 09:05:33 EDT 2008


Author: kabir.khan at jboss.com
Date: 2008-03-13 09:05:33 -0400 (Thu, 13 Mar 2008)
New Revision: 70817

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/AdvisorFactory.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/CallerConstructorInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/CallerMethodInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/ClassInstanceAdvisor.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/ConByConInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/ConByMethodInfo.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/Domain.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/DynamicAOPStrategy.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/FieldInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/GeneratedInstanceAdvisorMixin.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/MethodByConInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/MethodMatchInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/ReflectiveAspectBinder.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java
Log:
Tidyup, add generics and get rid of warnings

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/AdvisorFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/AdvisorFactory.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/AdvisorFactory.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -48,10 +48,10 @@
    protected static final int OTHER_ADVISOR = 1000; //The jrockit aop advisor is in another jar which we should not depend on
    protected static int advisor = 0;
    
-   protected static Constructor otherAdvisorConstructor;
+   protected static Constructor<?> otherAdvisorConstructor;
    
-   private static final Class[] NO_ARGS = new Class[0];
-   private static final Class[] CONSTRUCTOR_SIG = new Class[] {String.class, AspectManager.class};
+   private static final Class<?>[] NO_ARGS = new Class<?>[0];
+   private static final Class<?>[] CONSTRUCTOR_SIG = new Class<?>[] {String.class, AspectManager.class};
    
    
    public static void initialise(String property)
@@ -72,7 +72,7 @@
             try
             {
                // FIXME ClassLoader - why should this class be visible from the context classloader?
-               Class otherAdvisorClass = SecurityActions.getContextClassLoader().loadClass(property);
+               Class<?> otherAdvisorClass = SecurityActions.getContextClassLoader().loadClass(property);
                otherAdvisorConstructor = otherAdvisorClass.getConstructor(CONSTRUCTOR_SIG);
             }
             catch (ClassNotFoundException e)
@@ -95,7 +95,7 @@
       }
    }
 
-   public static ClassAdvisor getClassAdvisor(Class clazz, AspectManager am)
+   public static ClassAdvisor getClassAdvisor(Class<?> clazz, AspectManager am)
    {
       return getClassAdvisor(clazz.getName(), am, clazz);
    }
@@ -105,7 +105,7 @@
       return getClassAdvisor(clazz.getName(), am, null);
    }
    
-   private static ClassAdvisor getClassAdvisor(String className, AspectManager am, Class loadedClass)
+   private static ClassAdvisor getClassAdvisor(String className, AspectManager am, Class<?> loadedClass)
    {
       if(advisor == CLASS)
       {

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/CallerConstructorInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/CallerConstructorInfo.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/CallerConstructorInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -36,13 +36,13 @@
  **/
 public abstract class CallerConstructorInfo extends JoinPointInfo implements ConstructorCall
 {
-   private final Constructor constructor;
-   private final Class callingClass;
+   private final Constructor<?> constructor;
+   private final Class<?> callingClass;
    private final Method wrappingMethod;
    private final long calledConHash;
-   private final Class calledClass;
+   private final Class<?> calledClass;
    
-   public CallerConstructorInfo(Advisor advisor, Class calledClass, Constructor called, long calledConHash, Method wrappingMethod, Interceptor[] in, Class clazz)
+   public CallerConstructorInfo(Advisor advisor, Class<?> calledClass, Constructor<?> called, long calledConHash, Method wrappingMethod, Interceptor[] in, Class<?> clazz)
    {
       super(advisor, clazz);
       this.calledClass = calledClass;
@@ -66,12 +66,12 @@
       this.calledClass = other.calledClass;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return constructor;
    }
 
-   public Class getCallingClass()
+   public Class<?> getCallingClass()
    {
       return callingClass;
    }
@@ -86,7 +86,7 @@
       return calledConHash;
    }
 
-   public Class getCalledClass()
+   public Class<?> getCalledClass()
    {
       return calledClass;
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/CallerMethodInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/CallerMethodInfo.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/CallerMethodInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -35,12 +35,12 @@
  **/
 public abstract class CallerMethodInfo extends JoinPointInfo implements MethodCall
 {
-   private final Class callingClass;
-   private final Class calledClass;
+   private final Class<?> callingClass;
+   private final Class<?> calledClass;
    private final Method method;
    private final long calledMethodHash;
 
-   public CallerMethodInfo(Advisor advisor, Class calledClass, Method m, long calledMethodHash, Interceptor[] in, Class clazz)
+   public CallerMethodInfo(Advisor advisor, Class<?> calledClass, Method m, long calledMethodHash, Interceptor[] in, Class<?> clazz)
    {
       super(advisor, clazz);
       this.calledClass = calledClass;
@@ -62,12 +62,12 @@
       this.calledMethodHash = other.calledMethodHash;
    }
 
-   public Class getCallingClass()
+   public Class<?> getCallingClass()
    {
       return callingClass;
    }
 
-   public Class getCalledClass()
+   public Class<?> getCalledClass()
    {
       return calledClass;
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/ClassInstanceAdvisor.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/ClassInstanceAdvisor.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ClassInstanceAdvisor.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -31,7 +31,6 @@
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 
 /**
  * Holds an object instance's metadata and attached interceptors
@@ -43,10 +42,10 @@
 {
    static final long serialVersionUID = -3057976129116723527L;
 
-   protected ArrayList insertedInterceptors = null;
-   protected ArrayList appendedInterceptors = null;
-   protected WeakReference instanceRef;
-   protected transient WeakReference classAdvisorRef;
+   protected ArrayList<Interceptor> insertedInterceptors = null;
+   protected ArrayList<Interceptor> appendedInterceptors = null;
+   protected WeakReference<Object> instanceRef;
+   protected transient WeakReference<Advisor> classAdvisorRef;
    public boolean hasInstanceAspects = false;
    /**
     * aspects is a weak hash map of AspectDefinitions so that perinstance advices can be undeployed/redeployed
@@ -61,7 +60,7 @@
 
    public ClassInstanceAdvisor(Object obj)
    {
-      this.instanceRef = new WeakReference(obj);
+      this.instanceRef = new WeakReference<Object>(obj);
       if (obj instanceof Advised)
       {
          Advised advised = (Advised) obj;
@@ -77,7 +76,7 @@
    
    private void setAdvisorAndInitialise(Advisor advizor)
    {
-      this.classAdvisorRef = new WeakReference(advizor);
+      this.classAdvisorRef = new WeakReference<Advisor>(advizor);
       
       if (advizor instanceof ClassAdvisor)
       {
@@ -113,10 +112,10 @@
 
    public Interceptor[] getInterceptors()
    {
-      ArrayList newlist = new ArrayList();
+      ArrayList<Interceptor> newlist = new ArrayList<Interceptor>();
       if (insertedInterceptors != null) newlist.addAll(insertedInterceptors);
       if (appendedInterceptors != null) newlist.addAll(appendedInterceptors);
-      return (Interceptor[]) newlist.toArray(new Interceptor[newlist.size()]);
+      return newlist.toArray(new Interceptor[newlist.size()]);
    }
 
    /**
@@ -125,19 +124,19 @@
    public Interceptor[] getInterceptors(Interceptor[] advisorChain)
    {
       if (insertedInterceptors == null && appendedInterceptors == null) return advisorChain;
-      ArrayList newlist = new ArrayList();
+      ArrayList<Interceptor> newlist = new ArrayList<Interceptor>();
       if (insertedInterceptors != null) newlist.addAll(insertedInterceptors);
       if (advisorChain != null)
       {
          newlist.addAll(Arrays.asList(advisorChain));
       }
       if (appendedInterceptors != null) newlist.addAll(appendedInterceptors);
-      return (Interceptor[]) newlist.toArray(new Interceptor[newlist.size()]);
+      return newlist.toArray(new Interceptor[newlist.size()]);
    }
 
    public void insertInterceptor(int index, Interceptor interceptor)
    {
-      ArrayList newList = new ArrayList();
+      ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
       if (insertedInterceptors != null)
       {
          newList.addAll(insertedInterceptors);
@@ -153,7 +152,7 @@
 
    public void insertInterceptor(Interceptor interceptor)
    {
-      ArrayList newList = new ArrayList();
+      ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
       if (insertedInterceptors != null)
       {
          newList.addAll(insertedInterceptors);
@@ -169,7 +168,7 @@
 
    public void appendInterceptor(Interceptor interceptor)
    {
-      ArrayList newList = new ArrayList();
+      ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
       if (appendedInterceptors != null)
       {
          newList.addAll(appendedInterceptors);
@@ -185,7 +184,7 @@
 
    public void appendInterceptor(int index, Interceptor interceptor)
    {
-      ArrayList newList = new ArrayList();
+      ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
       if (appendedInterceptors != null)
       {
          newList.addAll(appendedInterceptors);
@@ -222,10 +221,10 @@
       {
          for (int i = 0; i < insertedInterceptors.size(); i++)
          {
-            Interceptor interceptor = (Interceptor) insertedInterceptors.get(i);
+            Interceptor interceptor = insertedInterceptors.get(i);
             if (interceptor.getName().equals(name))
             {
-               ArrayList newList = new ArrayList();
+               ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
                newList.addAll(insertedInterceptors);
                newList.remove(i);
                insertedInterceptors = newList;
@@ -237,10 +236,10 @@
       {
          for (int i = 0; i < appendedInterceptors.size(); i++)
          {
-            Interceptor interceptor = (Interceptor) appendedInterceptors.get(i);
+            Interceptor interceptor = appendedInterceptors.get(i);
             if (interceptor.getName().equals(name))
             {
-               ArrayList newList = new ArrayList();
+               ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
                newList.addAll(appendedInterceptors);
                newList.remove(i);
                appendedInterceptors = newList;
@@ -270,10 +269,8 @@
          classAdvisor = ((ClassAdvisor) advised._getAdvisor());
       }
       int interceptorsAdded = 0;
-      Iterator it = stack.getInterceptorFactories().iterator();
-      while (it.hasNext())
+      for (InterceptorFactory factory : stack.getInterceptorFactories())
       {
-         InterceptorFactory factory = (InterceptorFactory) it.next();
          if (!factory.isDeployed()) continue;
          Interceptor interceptor = factory.create(classAdvisor, null);
          insertInterceptor(interceptor);
@@ -297,10 +294,8 @@
          classAdvisor = ((ClassAdvisor) advised._getAdvisor());
       }
       int interceptorsAdded = 0;
-      Iterator it = stack.getInterceptorFactories().iterator();
-      while (it.hasNext())
+      for (InterceptorFactory factory : stack.getInterceptorFactories())
       {
-         InterceptorFactory factory = (InterceptorFactory) it.next();
          if (!factory.isDeployed()) continue;
          Interceptor interceptor = factory.create(classAdvisor, null);
          appendInterceptor(interceptor);
@@ -324,10 +319,8 @@
          classAdvisor = ((ClassAdvisor) advised._getAdvisor());
       }
       int interceptorsRemoved = 0;
-      Iterator it = stack.getInterceptorFactories().iterator();
-      while (it.hasNext())
+      for (InterceptorFactory factory : stack.getInterceptorFactories())
       {
-         InterceptorFactory factory = (InterceptorFactory) it.next();
          if (!factory.isDeployed()) continue;
          Interceptor interceptor = factory.create(classAdvisor, null);
          interceptorsRemoved += internalRemoveInterceptor(interceptor.getName());
@@ -362,7 +355,7 @@
    {
       if (classAdvisorRef != null)
       {
-         return (Advisor)classAdvisorRef.get();
+         return classAdvisorRef.get();
       }
       return null;
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/ConByConInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/ConByConInfo.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ConByConInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -37,9 +37,9 @@
 public class ConByConInfo extends CallerConstructorInfo implements ConstructorCallByConstructor
 {
    private final int callingIndex;
-   private final Constructor calling;
+   private final Constructor<?> calling;
    
-   public ConByConInfo(Advisor advisor, Class calledClass, Class callingClass, int callingIndex, Constructor called, long calledConHash, Method wrappingMethod, Interceptor[] in)
+   public ConByConInfo(Advisor advisor, Class<?> calledClass, Class<?> callingClass, int callingIndex, Constructor<?> called, long calledConHash, Method wrappingMethod, Interceptor[] in)
    {
       super(advisor, calledClass, called, calledConHash, wrappingMethod, in, callingClass);
       this.callingIndex = callingIndex;
@@ -88,12 +88,12 @@
 
    //Use getCallingConstructor instead
    @Deprecated()
-   public Constructor getCalling()
+   public Constructor<?> getCalling()
    {
       return calling;
    }
    
-   public Constructor getCallingConstructor()
+   public Constructor<?> getCallingConstructor()
    {
       return calling;
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/ConByMethodInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/ConByMethodInfo.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ConByMethodInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -28,7 +28,6 @@
 import org.jboss.aop.joinpoint.ConstructorCalledByMethodJoinpoint;
 import org.jboss.aop.joinpoint.ConstructorCallByMethod;
 import org.jboss.aop.joinpoint.Joinpoint;
-import org.jboss.aop.util.MethodHashing;
 
 /**
  * 
@@ -46,9 +45,8 @@
     * @param c
     * @param in
     */
-   public ConByMethodInfo(Advisor advisor, Class calledClass, Method callingMethod, long callingMethodHash, Constructor c, long calledConHash, Method wrappingMethod, Interceptor[] in)
+   public ConByMethodInfo(Advisor advisor, Class<?> calledClass, Method callingMethod, long callingMethodHash, Constructor<?> c, long calledConHash, Method wrappingMethod, Interceptor[] in)
    {
-      // FIXME ConByMethodJoinPont constructor
       super(advisor, calledClass, c, calledConHash, wrappingMethod, in, callingMethod.getDeclaringClass());
       this.callingMethodHash = callingMethodHash;
       this.callingMethod = callingMethod;

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 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructionInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -36,7 +36,7 @@
  */
 public class ConstructionInfo extends JoinPointInfo implements Construction
 {
-   private Constructor constructor;
+   private Constructor<?> constructor;
    private int index;
 
    public ConstructionInfo()
@@ -44,7 +44,7 @@
       
    }
    
-   public ConstructionInfo(Class clazz, int index, long constructorHash, Advisor advisor)
+   public ConstructionInfo(Class<?> clazz, int index, long constructorHash, Advisor advisor)
    {
       super(advisor, clazz);
       try
@@ -88,12 +88,12 @@
       return sb.toString();
    }
 
-   public void setConstructor(Constructor constructor)
+   public void setConstructor(Constructor<?> constructor)
    {
       this.constructor = constructor;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return constructor;
    }

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 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ConstructorInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -38,14 +38,14 @@
 public class ConstructorInfo extends JoinPointInfo implements ConstructorExecution
 {
    private Method wrapper;
-   private Constructor constructor;
+   private Constructor<?> constructor;
    private int index;
    
    public ConstructorInfo()
    {
    }
    
-   public ConstructorInfo(Class clazz, int index, long wrapperHash, long constructorHash, Advisor advisor)
+   public ConstructorInfo(Class<?> clazz, int index, long wrapperHash, long constructorHash, Advisor advisor)
    {
       super(advisor, clazz);
       try
@@ -98,12 +98,12 @@
       return wrapper;
    }
 
-   public void setConstructor(Constructor constructor)
+   public void setConstructor(Constructor<?> constructor)
    {
       this.constructor = constructor;
    }
 
-   public Constructor getConstructor()
+   public Constructor<?> getConstructor()
    {
       return constructor;
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/Domain.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/Domain.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/Domain.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -21,6 +21,7 @@
   */
 package org.jboss.aop;
 
+import java.lang.ref.WeakReference;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -603,11 +604,11 @@
    }
 
    @Override
-   public Map getPerVMAspects()
+   public Map<String, Object> getPerVMAspects()
    {
       if (inheritsBindings)
       {
-         HashMap map = new HashMap();
+         HashMap<String, Object> map = new HashMap<String, Object>();
          if (!parentFirst)
          {
             // when child first, parent bindings go in first so that they can be overridden by child.
@@ -632,20 +633,20 @@
    }
 
    @Override
-   public LinkedHashMap getPrecedenceDefs()
+   public LinkedHashMap<String, PrecedenceDef> getPrecedenceDefs()
    {
       if (inheritsDeclarations)
       {
          if (!parentFirst)
          {
             // when child first, parent bindings go in first so that they can be overridden by child.
-            LinkedHashMap map = new LinkedHashMap(parent.getPrecedenceDefs());
+            LinkedHashMap<String, PrecedenceDef> map = new LinkedHashMap<String, PrecedenceDef>(parent.getPrecedenceDefs());
             map.putAll(this.precedenceDefs);
             return map;
          }
          else
          {
-            LinkedHashMap map = new LinkedHashMap(this.precedenceDefs);
+            LinkedHashMap<String, PrecedenceDef> map = new LinkedHashMap<String, PrecedenceDef>(this.precedenceDefs);
             map.putAll(parent.getPrecedenceDefs());
             return map;
          }
@@ -846,7 +847,7 @@
    }
 
    @Override
-   public void attachMetaData(Advisor advisor, Class clazz)
+   public void attachMetaData(Advisor advisor, Class<?> clazz)
    {
       if (inheritsBindings)
       {
@@ -965,13 +966,13 @@
          if (!parentFirst)
          {
             // when child first, parent bindings go in first so that they can be overridden by child.
-            LinkedHashMap map = new LinkedHashMap(parent.getLifecycleBindings());
+            LinkedHashMap<String, LifecycleCallbackBinding> map = new LinkedHashMap<String, LifecycleCallbackBinding>(parent.getLifecycleBindings());
             map.putAll(super.getLifecycleBindings());
             return map;
          }
          else
          {
-            LinkedHashMap map = new LinkedHashMap(super.getLifecycleBindings());
+            LinkedHashMap<String, LifecycleCallbackBinding> map = new LinkedHashMap<String, LifecycleCallbackBinding>(super.getLifecycleBindings());
             map.putAll(parent.getLifecycleBindings());
             return map;
          }
@@ -992,28 +993,28 @@
 
    /** Managed by the top-level aspect manager */
    @Override
-   protected Map getSubDomainsPerClass()
+   protected Map<Class<?>, WeakReference<Domain>> getSubDomainsPerClass()
    {
       return parent.getSubDomainsPerClass();
    }
 
    /** Only set on a per vm basis */
    @Override
-   public ArrayList getExclude()
+   public ArrayList<String> getExclude()
    {
       return parent.getExclude();
    }
 
    /** Only set on a per vm basis */
    @Override
-   public ArrayList getInclude()
+   public ArrayList<String> getInclude()
    {
       return parent.getInclude();
    }
 
    /** Only set on a per vm basis */
    @Override
-   public ArrayList getIgnore()
+   public ArrayList<String> getIgnore()
    {
       return parent.getIgnore();
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/DynamicAOPStrategy.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/DynamicAOPStrategy.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/DynamicAOPStrategy.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -52,7 +52,7 @@
     * @return the interceptor chain observer for <code>clazz</code>. May
     * return null if the strategy doesn't require an observer at all.
     */
-   InterceptorChainObserver getInterceptorChainObserver(Class clazz);
+   InterceptorChainObserver getInterceptorChainObserver(Class<?> clazz);
    
    /**
     * Notifies the strategy that one or more interceptor chains in the

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 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/FieldInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -56,7 +56,7 @@
       this.read = read;
    }
    
-   public FieldInfo(Class clazz, int index, String fieldName, long wrapperHash, Advisor advisor, boolean read)
+   public FieldInfo(Class<?> clazz, int index, String fieldName, long wrapperHash, Advisor advisor, boolean read)
    {
       super(advisor, clazz);
 
@@ -169,10 +169,10 @@
       return null;
    }
 
-   private Field doGet(Class clazz, String name)throws NoSuchFieldException
+   private Field doGet(Class<?> clazz, String name)throws NoSuchFieldException
    {
       Field field = null;
-      Class superClass = clazz;
+      Class<?> superClass = clazz;
       while (superClass != null)
       {
          try
@@ -196,19 +196,19 @@
    
    interface GetDeclaredFieldAction
    {
-      Field get(FieldInfo target, Class clazz, String name) throws NoSuchFieldException;
+      Field get(FieldInfo target, Class<?> clazz, String name) throws NoSuchFieldException;
       
       GetDeclaredFieldAction PRIVILEGED = new GetDeclaredFieldAction()
       {
-         public Field get(final FieldInfo target, final Class clazz, final String name) throws NoSuchFieldException
+         public Field get(final FieldInfo target, final Class<?> clazz, final String name) throws NoSuchFieldException
          {
             try
             {
-               return (Field)AccessController.doPrivileged(new PrivilegedExceptionAction()
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<Field>()
                {
-                  public Object run() throws Exception
+                  public Field run() throws Exception
                   {
-                     return target.doGet(clazz, name);//clazz.getDeclaredField(name);
+                     return target.doGet(clazz, name);
                   }
                });
             }
@@ -226,7 +226,7 @@
 
       GetDeclaredFieldAction NON_PRIVILEGED = new GetDeclaredFieldAction()
       {
-         public Field get(FieldInfo target, Class clazz, String name) throws NoSuchFieldException
+         public Field get(FieldInfo target, Class<?> clazz, String name) throws NoSuchFieldException
          {
             return target.doGet(clazz, name);//clazz.getDeclaredField(name);
          }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/GeneratedInstanceAdvisorMixin.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/GeneratedInstanceAdvisorMixin.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/GeneratedInstanceAdvisorMixin.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -33,7 +33,6 @@
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 
 /**
  * Adapts the old instance advisor api to the new generated advisor stuff. 
@@ -92,22 +91,22 @@
 
    public Interceptor[] getInterceptors()
    {
-      ArrayList newlist = new ArrayList();
-      if (insertedInterceptors != null) 
+      ArrayList<Interceptor> newlist = new ArrayList<Interceptor>();
+      if (insertedInterceptors != null && insertedInterceptors.size() > 0) 
       {
-         for (Iterator it = insertedInterceptors.iterator() ; it.hasNext() ; )
+         for (Interceptor icptr : insertedInterceptors)
          {
-            newlist.add(((GeneratedAdvisorInterceptor)it.next()).create(null, null));
+            newlist.add(((GeneratedAdvisorInterceptor)icptr).create(null, null));
          }
       }
-      if (appendedInterceptors != null) 
+      if (appendedInterceptors != null && appendedInterceptors.size() > 0) 
       {
-         for (Iterator it = appendedInterceptors.iterator() ; it.hasNext() ; )
+         for (Interceptor icptr : appendedInterceptors)
          {
-            newlist.add(((GeneratedAdvisorInterceptor)it.next()).create(null, null));
+            newlist.add(((GeneratedAdvisorInterceptor)icptr).create(null, null));
          }
       }
-      return (Interceptor[]) newlist.toArray(new Interceptor[newlist.size()]);
+      return newlist.toArray(new Interceptor[newlist.size()]);
    }
 
    /**
@@ -116,34 +115,34 @@
    public Interceptor[] getInterceptors(Interceptor[] advisorChain)
    {
       if (insertedInterceptors == null && appendedInterceptors == null) return advisorChain;
-      ArrayList newlist = new ArrayList();
-      if (insertedInterceptors != null) 
+      ArrayList<Interceptor> newlist = new ArrayList<Interceptor>();
+      if (insertedInterceptors != null && insertedInterceptors.size() > 0) 
       {
-         for (Iterator it = insertedInterceptors.iterator() ; it.hasNext() ; )
+         for (Interceptor icptr : insertedInterceptors)
          {
-            newlist.add(((GeneratedAdvisorInterceptor)it.next()).create(null, null));
+            newlist.add(((GeneratedAdvisorInterceptor)icptr).create(null, null));
          }
       }
       if (advisorChain != null)
       {
          newlist.addAll(Arrays.asList(advisorChain));
       }
-      if (appendedInterceptors != null) 
+      if (appendedInterceptors != null && appendedInterceptors.size() > 0) 
       {
-         for (Iterator it = appendedInterceptors.iterator() ; it.hasNext() ; )
+         for (Interceptor icptr : appendedInterceptors)
          {
-            newlist.add(((GeneratedAdvisorInterceptor)it.next()).create(null, null));
+            newlist.add(((GeneratedAdvisorInterceptor)icptr).create(null, null));
          }
       }
-      return (Interceptor[]) newlist.toArray(new Interceptor[newlist.size()]);
+      return newlist.toArray(new Interceptor[newlist.size()]);
    }
 
    public GeneratedAdvisorInterceptor[] getWrappers()
    {
-      ArrayList newlist = new ArrayList();
+      ArrayList<Interceptor> newlist = new ArrayList<Interceptor>();
       if (insertedInterceptors != null) newlist.addAll(insertedInterceptors);
       if (appendedInterceptors != null) newlist.addAll(appendedInterceptors);
-      return (GeneratedAdvisorInterceptor[]) newlist.toArray(new GeneratedAdvisorInterceptor[newlist.size()]);
+      return newlist.toArray(new GeneratedAdvisorInterceptor[newlist.size()]);
    }
 
    /**
@@ -154,20 +153,20 @@
    public Interceptor[] getWrappers(Interceptor[] advisorChain)
    {
       if (insertedInterceptors == null && appendedInterceptors == null) return advisorChain;
-      ArrayList newlist = new ArrayList();
+      ArrayList<Interceptor> newlist = new ArrayList<Interceptor>();
       if (insertedInterceptors != null) newlist.addAll(insertedInterceptors);
       if (advisorChain != null)
       {
          newlist.addAll(Arrays.asList(advisorChain));
       }
       if (appendedInterceptors != null) newlist.addAll(appendedInterceptors);
-      return (GeneratedAdvisorInterceptor[]) newlist.toArray(new GeneratedAdvisorInterceptor[newlist.size()]);
+      return newlist.toArray(new GeneratedAdvisorInterceptor[newlist.size()]);
    }
 
    public void insertInterceptor(int index, Interceptor interceptor)
    {
-      ArrayList newList = new ArrayList();
-      if (insertedInterceptors != null)
+      ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
+      if (insertedInterceptors != null && insertedInterceptors.size() > 0)
       {
          newList.addAll(insertedInterceptors);
       }
@@ -182,8 +181,8 @@
 
    public void insertInterceptor(Interceptor interceptor)
    {
-      ArrayList newList = new ArrayList();
-      if (insertedInterceptors != null)
+      ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
+      if (insertedInterceptors != null && insertedInterceptors.size() > 0)
       {
          newList.addAll(insertedInterceptors);
       }
@@ -199,7 +198,7 @@
    public void appendInterceptor(Interceptor interceptor)
    {
       ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
-      if (appendedInterceptors != null)
+      if (appendedInterceptors != null && appendedInterceptors.size() > 0)
       {
          newList.addAll(appendedInterceptors);
       }
@@ -214,8 +213,8 @@
 
    public void appendInterceptor(int index, Interceptor interceptor)
    {
-      ArrayList newList = new ArrayList();
-      if (appendedInterceptors != null)
+      ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
+      if (appendedInterceptors != null && appendedInterceptors.size() > 0)
       {
          newList.addAll(appendedInterceptors);
       }
@@ -249,12 +248,13 @@
       int interceptorsRemoved = 0;
       if (insertedInterceptors != null)
       {
-         for (int i = 0; i < insertedInterceptors.size(); i++)
+         int size = insertedInterceptors.size();
+         for (int i = 0; i < size ; i++)
          {
             GeneratedAdvisorInterceptor interceptor = (GeneratedAdvisorInterceptor) insertedInterceptors.get(i);
             if (interceptor.getName().equals(name))
             {
-               ArrayList newList = new ArrayList();
+               ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
                newList.addAll(insertedInterceptors);
                newList.remove(i);
                insertedInterceptors = newList;
@@ -264,12 +264,13 @@
       }
       if (appendedInterceptors != null)
       {
-         for (int i = 0; i < appendedInterceptors.size(); i++)
+         int size = appendedInterceptors.size();
+         for (int i = 0; i < size ; i++)
          {
             GeneratedAdvisorInterceptor interceptor = (GeneratedAdvisorInterceptor) appendedInterceptors.get(i);
             if (interceptor.getName().equals(name))
             {
-               ArrayList newList = new ArrayList();
+               ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
                newList.addAll(appendedInterceptors);
                newList.remove(i);
                appendedInterceptors = newList;
@@ -300,10 +301,8 @@
          classAdvisor = ((ClassAdvisor) advised._getAdvisor());
       }
       int interceptorsAdded = 0;
-      Iterator it = stack.getInterceptorFactories().iterator();
-      while (it.hasNext())
+      for (InterceptorFactory factory : stack.getInterceptorFactories())
       {
-         InterceptorFactory factory = (InterceptorFactory) it.next();
          if (!factory.isDeployed()) continue;
          Interceptor interceptor = factory.create(classAdvisor, null);
          insertInterceptor(interceptor);
@@ -328,10 +327,8 @@
          classAdvisor = ((ClassAdvisor) advised._getAdvisor());
       }
       int interceptorsAdded = 0;
-      Iterator it = stack.getInterceptorFactories().iterator();
-      while (it.hasNext())
+      for (InterceptorFactory factory : stack.getInterceptorFactories())
       {
-         InterceptorFactory factory = (InterceptorFactory) it.next();
          if (!factory.isDeployed()) continue;
          Interceptor interceptor = factory.create(classAdvisor, null);
          appendInterceptor(interceptor);
@@ -356,10 +353,8 @@
          classAdvisor = ((ClassAdvisor) advised._getAdvisor());
       }
       int interceptorsRemoved = 0;
-      Iterator it = stack.getInterceptorFactories().iterator();
-      while (it.hasNext())
+      for (InterceptorFactory factory : stack.getInterceptorFactories())
       {
-         InterceptorFactory factory = (InterceptorFactory) it.next();
          if (!factory.isDeployed()) continue;
          Interceptor interceptor = factory.create(classAdvisor, null);
          interceptorsRemoved += internalRemoveInterceptor(interceptor.getName());

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -29,7 +29,6 @@
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.WeakHashMap;
 
 import javassist.ClassPool;
@@ -57,7 +56,7 @@
 public class HotSwapStrategy implements DynamicAOPStrategy
 {
    private HotSwapper hotSwapper;
-   private Collection joinpointUpdates;
+   private Collection<JoinpointStatusUpdate> joinpointUpdates;
    private Instrumentor instrumentor;
 
    /**
@@ -67,7 +66,7 @@
    public HotSwapStrategy(HotSwapper hotSwapper)
    {
       this.hotSwapper = hotSwapper;
-      this.joinpointUpdates = new ArrayList();
+      this.joinpointUpdates = new ArrayList<JoinpointStatusUpdate>();
       this.instrumentor = InstrumentorFactory.getInstrumentor(AspectManager.instance(), getJoinpointClassifier());
    }
    
@@ -84,7 +83,7 @@
       {
          if (!joinpointUpdates.isEmpty())
          {
-            instrumentor.interceptorChainsUpdated(new ArrayList(joinpointUpdates), hotSwapper);
+            instrumentor.interceptorChainsUpdated(new ArrayList<JoinpointStatusUpdate>(joinpointUpdates), hotSwapper);
             joinpointUpdates.clear();   
          }
       }
@@ -125,7 +124,7 @@
     * Returns an interceptor chain observer for <code>clazz</code>.
     * @see org.jboss.aop.DynamicAOPStrategy#getInterceptorChainObserver
     */
-   public InterceptorChainObserver getInterceptorChainObserver(Class clazz)
+   public InterceptorChainObserver getInterceptorChainObserver(Class<?> clazz)
    {
       ClassPool classPool = AspectManager.instance().findClassPool(clazz.getClassLoader());
       CtClass ctClass = null;
@@ -163,9 +162,9 @@
     */
    private class  DynamicTransformationTracker implements DynamicTransformationObserver
    {
-      private CtClass clazz;
-      private Collection fieldReads;
-      private Collection fieldWrites;
+      //private CtClass clazz;
+      private Collection<CtField> fieldReads;
+      private Collection<CtField> fieldWrites;
       private boolean constructor;
 
       /**
@@ -174,9 +173,9 @@
        */
       public DynamicTransformationTracker(CtClass clazz)
       {
-         this.clazz = clazz;
-         this.fieldReads = new ArrayList();
-         this.fieldWrites = new ArrayList();
+         //this.clazz = clazz;
+         this.fieldReads = new ArrayList<CtField>();
+         this.fieldWrites = new ArrayList<CtField>();
          this.constructor = false;
       }
       
@@ -238,7 +237,7 @@
       private JoinpointStatusUpdate.ClassJoinpoints newlyUnadvised;
       
       private int instanceInterceptors;
-      private WeakHashMap instanceAdvisors;
+      private WeakHashMap<InstanceAdvisor, Integer> instanceAdvisors;
       
       private CtClass clazz;
       private int fields;
@@ -257,17 +256,17 @@
       public JoinpointStatusUpdater(CtClass clazz)
       {
          this.clazz = clazz;
-         this.instanceAdvisors = new WeakHashMap();
+         this.instanceAdvisors = new WeakHashMap<InstanceAdvisor, Integer>();
       }
       
       /**
        * This method must be called before any other notification method is invoked.
        * @see org.jboss.aop.InterceptorChainObserver#initialInterceptorChains(Interceptor[][], Interceptor[][], Interceptor[][], TLongObjectHashMap)
        */
-      public synchronized void initialInterceptorChains(final Class reflectionClass, Interceptor[][] fieldReadInterceptors, Interceptor[][] fieldWriteInterceptors,
+      public synchronized void initialInterceptorChains(final Class<?> reflectionClass, Interceptor[][] fieldReadInterceptors, Interceptor[][] fieldWriteInterceptors,
             Interceptor[][] constructorInterceptors, MethodInterceptors methodInterceptors)
       {
-         Constructor[] declaredConstructors = null;
+         Constructor<?>[] declaredConstructors = null;
          if (System.getSecurityManager() == null)
          {
             declaredConstructors = reflectionClass.getDeclaredConstructors();
@@ -277,9 +276,9 @@
             try
             {
                declaredConstructors = 
-                  AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor[]>()
+                  AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor<?>[]>()
                {
-                  public Constructor[] run() throws Exception
+                  public Constructor<?>[] run() throws Exception
                   {
                      return reflectionClass.getDeclaredConstructors();
                   }
@@ -297,7 +296,7 @@
          int javassistIndex = 0;
          for (int reflectionIndex = 0; reflectionIndex < declaredConstructors.length; reflectionIndex++)
          {
-            Class[] params = declaredConstructors[reflectionIndex].getParameterTypes();
+            Class<?>[] params = declaredConstructors[reflectionIndex].getParameterTypes();
             if (params.length > 0 && params[params.length-1].getName().equals("javassist.runtime.Inner"))
             {
                constructorIndexMap[reflectionIndex] = -1;
@@ -333,7 +332,7 @@
             for (int i = 0; i < methodKeys.length; i++)
             {
                long key = methodKeys[i];
-               MethodInfo oldMethodInfo = (MethodInfo) methodInterceptors.getMethodInfo(key);
+               MethodInfo oldMethodInfo = methodInterceptors.getMethodInfo(key);
                MethodInfo newMethodInfo = newMethodInterceptors.getMethodInfo(key);
                if (oldMethodInfo.getInterceptorChain().isEmpty() && !newMethodInfo.getInterceptorChain().isEmpty())
                {
@@ -410,9 +409,8 @@
          if (this.instanceInterceptors == 0)
             return;
          this.instanceInterceptors = 0;
-         for (Iterator iterator = instanceAdvisors.values().iterator(); iterator.hasNext(); )
+         for (Integer interceptors : instanceAdvisors.values())
          {
-            Integer interceptors = (Integer) iterator.next();
             instanceInterceptors += interceptors.intValue();
          }
          if (this.instanceInterceptors > 0)
@@ -446,7 +444,7 @@
        * @param newlyAdvised collection to which the newly unadvised joinpoints will be added.
        */
       private void fillNewStateCollections(Interceptor[][] interceptors, Interceptor[][] newInterceptors,
-            Collection newlyAdvised, Collection newlyUnadvised, int[] indexMap)
+            Collection<Integer> newlyAdvised, Collection<Integer> newlyUnadvised, int[] indexMap)
       {
          if (instanceInterceptors > 0)
             return;
@@ -498,7 +496,7 @@
       {
          if (this.instanceAdvisors.containsKey(instanceAdvisor))
          {
-            Integer interceptors = (Integer) instanceAdvisors.get(instanceAdvisor);
+            Integer interceptors = instanceAdvisors.get(instanceAdvisor);
             instanceAdvisors.put(instanceAdvisor, new Integer(interceptors.intValue() + interceptorsAdded));
          }
          else
@@ -521,7 +519,7 @@
             for (int i = 0; i < methodKeys.length; i++)
             {
                long key = methodKeys[i];
-               MethodInfo methodInfo = (MethodInfo) this.methodInterceptors.getMethodInfo(key);
+               MethodInfo methodInfo = this.methodInterceptors.getMethodInfo(key);
                if (methodInfo.getInterceptorChain().isEmpty())
                {
                   joinpoints.methodExecutions.add(methodInfo);  
@@ -539,7 +537,7 @@
        * @param interceptors the interceptors chains applied to the joinponts.
        * @param joinpointsFound the collection to which the found joinpoints will be added.
        */
-      private void findUnadvisedJoinpoints(Interceptor[][] interceptors, Collection joinpointsFound)
+      private void findUnadvisedJoinpoints(Interceptor[][] interceptors, Collection<Integer> joinpointsFound)
       {
          for (int i = 0; i < interceptors.length; i++)
          {

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -42,7 +42,7 @@
     * @param methodInterceptors interceptor chains to be applied at methods' executions.
     * @param clazz the reflection class whose joinpoints the interceptor chains will be applied to.
     */
-   public void initialInterceptorChains(Class clazz, Interceptor[][] fieldReadInterceptors, Interceptor[][] fieldWriteInterceptors,
+   public void initialInterceptorChains(Class<?> clazz, Interceptor[][] fieldReadInterceptors, Interceptor[][] fieldWriteInterceptors,
          Interceptor[][] constructorInterceptors, MethodInterceptors methodInterceptors);
 
    /**

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 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -42,18 +42,18 @@
    
    protected volatile Joinpoint joinpoint;
    
-   protected WeakReference<Class> clazz;
+   protected WeakReference<Class<?>> clazz;
    
    private String adviceString;
 
    protected JoinPointInfo()
    {
-      this.clazz = new WeakReference<Class>(null);
+      this.clazz = new WeakReference<Class<?>>(null);
    }
    
-   protected JoinPointInfo(Advisor advisor, Class clazz)
+   protected JoinPointInfo(Advisor advisor, Class<?> clazz)
    {
-      this.clazz = new WeakReference<Class>(clazz); 
+      this.clazz = new WeakReference<Class<?>>(clazz); 
       setAdvisor(advisor);
    }
    
@@ -84,10 +84,10 @@
       {
          return null;
       }
-      return (Advisor)advisor.get();
+      return advisor.get();
    }
 
-   public Class getClazz()
+   public Class<?> getClazz()
    {
       return clazz.get(); 
    }
@@ -97,7 +97,7 @@
       this.advisor = new WeakReference<Advisor>(advisor);
       if (getClazz() == null && advisor != null)
       {
-         this.clazz = new WeakReference<Class>(advisor.getClazz());
+         this.clazz = new WeakReference<Class<?>>(advisor.getClazz());
       }
    }
 
@@ -205,7 +205,7 @@
       other.interceptorChainLock.readLock().lock();
       try
       {
-         interceptorChain = (ArrayList) other.interceptorChain.clone();
+         interceptorChain = (ArrayList<Interceptor>) other.interceptorChain.clone();
          if (other.interceptors == null)
          {
             interceptors = null;

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/MethodByConInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/MethodByConInfo.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/MethodByConInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -22,7 +22,6 @@
 package org.jboss.aop;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import org.jboss.aop.advice.Interceptor;
@@ -39,9 +38,9 @@
 {
 
    private final int callingIndex;
-   private final Constructor calling;
+   private final Constructor<?> calling;
    
-   public MethodByConInfo(Advisor advisor, Class calledClass, Class callingClass, int callingIndex, Method m, long calledMethodHash, Interceptor[] in)
+   public MethodByConInfo(Advisor advisor, Class<?> calledClass, Class<?> callingClass, int callingIndex, Method m, long calledMethodHash, Interceptor[] in)
    {
       // FIXME MethodByConInfo constructor
       super(advisor, calledClass, m, calledMethodHash, in, callingClass);
@@ -90,12 +89,12 @@
    }
 
    @Deprecated
-   public Constructor getCalling()
+   public Constructor<?> getCalling()
    {
       return calling;
    }
 
-   public Constructor getCallingConstructor()
+   public Constructor<?> getCallingConstructor()
    {
       return calling;
    }

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 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -41,7 +41,7 @@
    {
    }
    
-   public MethodInfo(Class clazz, long hash, long unadvisedHash, Advisor advisor)
+   public MethodInfo(Class<?> clazz, long hash, long unadvisedHash, Advisor advisor)
    {
       super(advisor, clazz);
 

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/MethodMatchInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/MethodMatchInfo.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/MethodMatchInfo.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -40,8 +40,8 @@
    
    Advisor advisor;
    MethodInfo info;
-   ArrayList bindings;
-   ArrayList pointcutMethodMatches;
+   ArrayList<AdviceBinding> bindings;
+   ArrayList<PointcutMethodMatch> pointcutMethodMatches;
    
    MethodMatchInfo(Advisor advisor, MethodInfo info)
    {
@@ -53,11 +53,11 @@
    {
       if (bindings == null)
       {
-         bindings = new ArrayList();
+         bindings = new ArrayList<AdviceBinding>();
       }
       if (pointcutMethodMatches == null)
       {
-         pointcutMethodMatches = new ArrayList();
+         pointcutMethodMatches = new ArrayList<PointcutMethodMatch>();
       }
       bindings.add(binding);
       pointcutMethodMatches.add(pointcutMethodMatch);
@@ -73,11 +73,11 @@
       this.info = info;
    }
    
-   public ArrayList populateBindings()
+   public ArrayList<AdviceBinding> populateBindings()
    {
       if (bindings != null)
       {
-         ArrayList applicableBindings = new ArrayList();
+         ArrayList<AdviceBinding> applicableBindings = new ArrayList<AdviceBinding>();
          if (advisor.chainOverridingForInheritedMethods())
          {
             overridePopulateBindings(applicableBindings);
@@ -95,25 +95,25 @@
       return null;
    }
    
-   private void simplePopulateBindings(ArrayList applicableBindings)
+   private void simplePopulateBindings(ArrayList<AdviceBinding> applicableBindings)
    {
       int size = bindings.size();
       for (int i = 0 ; i < size ; i++)
       {
-         AdviceBinding binding = (AdviceBinding)bindings.get(i);
+         AdviceBinding binding = bindings.get(i);
          applyBinding(applicableBindings, binding);
       }
    }
    
-   private void overridePopulateBindings(ArrayList applicableBindings)
+   private void overridePopulateBindings(ArrayList<AdviceBinding> applicableBindings)
    {
       if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("populate bindings for " + info.getMethod() + " all bindings");
       int size = bindings.size();
       int minMatchLevel = 1000000;
       for (int i = 0 ; i < size ; i++)
       {
-         AdviceBinding binding = (AdviceBinding)bindings.get(i);
-         PointcutMethodMatch match = (PointcutMethodMatch)pointcutMethodMatches.get(i);
+         AdviceBinding binding = bindings.get(i);
+         PointcutMethodMatch match = pointcutMethodMatches.get(i);
          if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug(match.getMatchLevel() + " " + match.getMatchedClass().getName() + " " + binding.getPointcut().getExpr() + " : " + binding.getInterceptorFactories().length);
          
          if (minMatchLevel > match.getMatchLevel() && !match.isInstanceOf())
@@ -125,8 +125,8 @@
       if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("populate bindings for " + info.getMethod() + " actual bindings");
       for (int i = 0 ; i < size ; i++)
       {
-         AdviceBinding binding = (AdviceBinding)bindings.get(i);
-         PointcutMethodMatch match = (PointcutMethodMatch)pointcutMethodMatches.get(i);
+         AdviceBinding binding = bindings.get(i);
+         PointcutMethodMatch match = pointcutMethodMatches.get(i);
          
          if (match.isInstanceOf() || match.getMatchLevel() == minMatchLevel)
          {
@@ -136,7 +136,7 @@
       }
    }
    
-   private void applyBinding(ArrayList applicableBindings, AdviceBinding binding)
+   private void applyBinding(ArrayList<AdviceBinding> applicableBindings, AdviceBinding binding)
    {
       applicableBindings.add(binding);
       binding.addAdvisor(advisor);

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/ReflectiveAspectBinder.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/ReflectiveAspectBinder.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ReflectiveAspectBinder.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -34,13 +34,14 @@
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.jboss.aop.advice.AdviceBinding;
+import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.aop.advice.InterceptorFactory;
 import org.jboss.aop.introduction.AnnotationIntroduction;
 import org.jboss.aop.microcontainer.lifecycle.LifecycleCallbackBinding;
 import org.jboss.aop.microcontainer.lifecycle.LifecycleCallbackDefinition;
@@ -48,8 +49,6 @@
 import org.jboss.aop.pointcut.PointcutMethodMatch;
 import org.jboss.aop.proxy.container.InstanceProxyContainer;
 import org.jboss.aop.util.Advisable;
-import org.jboss.aop.util.logging.AOPLogger;
-import org.jboss.logging.Logger;
 import org.jboss.util.MethodHashing;
 
 /**
@@ -59,12 +58,12 @@
  */
 public class ReflectiveAspectBinder
 {
-   protected Class clazz;
-   protected HashSet aspects = new HashSet();
-   protected HashMap methodAdvices = new HashMap();
-   protected HashMap constructorAdvices = new HashMap();
-   protected HashMap fieldReadAdvices = new HashMap();
-   protected HashMap fieldWriteAdvices = new HashMap();
+   protected Class<?> clazz;
+   protected HashSet<AspectDefinition> aspects = new HashSet<AspectDefinition>();
+   protected HashMap<Method, ArrayList<InterceptorFactory>> methodAdvices = new HashMap<Method, ArrayList<InterceptorFactory>>();
+   protected HashMap<Constructor<?>, ArrayList<InterceptorFactory>> constructorAdvices = new HashMap<Constructor<?>, ArrayList<InterceptorFactory>>();
+   protected HashMap<Field, ArrayList<InterceptorFactory>> fieldReadAdvices = new HashMap<Field, ArrayList<InterceptorFactory>>();
+   protected HashMap<Field, ArrayList<InterceptorFactory>> fieldWriteAdvices = new HashMap<Field, ArrayList<InterceptorFactory>>();
    protected Advisor advisor;
    protected boolean isInstanceContainer;
    TLongObjectHashMap methodMap = new TLongObjectHashMap();
@@ -74,23 +73,23 @@
    boolean initialisedAspects;
    boolean intitialisedLifecycleCallbacks;
    
-   public ReflectiveAspectBinder(Class clazz, Advisor advisor)
+   public ReflectiveAspectBinder(Class<?> clazz, Advisor advisor)
    {
       this.clazz = clazz;
       this.advisor = advisor;
       isInstanceContainer = InstanceProxyContainer.class == advisor.getClass();
    }
 
-   public Class getClazz()
+   public Class<?> getClazz()
    {
       return clazz;
    }
 
-   public HashSet getAspects()
+   public HashSet<AspectDefinition> getAspects()
    {
       if (!initialisedAspects)
       {
-         Map bindings = advisor.getManager().getBindings();
+         Map<String, AdviceBinding> bindings = advisor.getManager().getBindings();
          bindMethodAdvices(clazz, bindings);
          bindConstructorAdvices(bindings);
          bindFieldAdvices(bindings);
@@ -107,27 +106,27 @@
       return lifecycleCallbacks;
    }
    
-   public HashMap getMethodAdvices()
+   public HashMap<Method, ArrayList<InterceptorFactory>> getMethodAdvices()
    {
       return methodAdvices;
    }
 
-   public HashMap getConstructorAdvices()
+   public HashMap<Constructor<?>, ArrayList<InterceptorFactory>> getConstructorAdvices()
    {
       return constructorAdvices;
    }
 
-   public HashMap getFieldReadAdvices()
+   public HashMap<Field, ArrayList<InterceptorFactory>> getFieldReadAdvices()
    {
       return fieldReadAdvices;
    }
 
-   public HashMap getFieldWriteAdvices()
+   public HashMap<Field, ArrayList<InterceptorFactory>> getFieldWriteAdvices()
    {
       return fieldWriteAdvices;
    }
 
-   public void createMethodMap(final Class superClass)
+   public void createMethodMap(final Class<?> superClass)
    {
       try
       {
@@ -137,9 +136,9 @@
          }
          createMethodMap(superClass.getSuperclass());
          
-         Method[] methods = (Method[]) AccessController.doPrivileged(new PrivilegedExceptionAction() 
+         Method[] methods = AccessController.doPrivileged(new PrivilegedExceptionAction<Method[]>() 
          {
-            public Object run() throws Exception
+            public Method[] run() throws Exception
             {
                return superClass.getDeclaredMethods();
             }
@@ -165,7 +164,7 @@
       }
    }
    
-   protected void bindMethodAdvices(Class superClass, Map bindings)
+   protected void bindMethodAdvices(Class<?> superClass, Map<String, AdviceBinding> bindings)
    {
       createMethodMap(superClass); 
       if (methodMap != null)
@@ -178,11 +177,11 @@
       }
    }
 
-   protected void bindConstructorAdvices(Map bindings)
+   protected void bindConstructorAdvices(Map<String, AdviceBinding> bindings)
    {
-      Constructor[] cons = (Constructor[]) AccessController.doPrivileged(new PrivilegedAction() 
+      Constructor<?>[] cons = AccessController.doPrivileged(new PrivilegedAction<Constructor<?>[]>() 
       {
-         public Object run()
+         public Constructor<?>[] run()
          {
             return clazz.getDeclaredConstructors();
          }
@@ -193,11 +192,11 @@
       }
    }
 
-   protected void bindFieldAdvices(Map bindings)
+   protected void bindFieldAdvices(Map<String, AdviceBinding> bindings)
    {
-      Field[] fields = (Field[]) AccessController.doPrivileged(new PrivilegedAction() 
+      Field[] fields = AccessController.doPrivileged(new PrivilegedAction<Field[]>() 
       {
-         public Object run()
+         public Field[] run()
          {
             return clazz.getDeclaredFields();
          }
@@ -215,21 +214,18 @@
       return ((Boolean) ai.getTarget().jjtAccept(matcher, null)).booleanValue();
    }
 
-   protected void bindMethodAdvice(Method mi, Map bindings)
+   protected void bindMethodAdvice(Method mi, Map<String, AdviceBinding> bindings)
    {
-      Iterator it = bindings.values().iterator();
-      ArrayList advices = (ArrayList)methodAdvices.get(mi);
-      while (it.hasNext())
+      ArrayList<InterceptorFactory> advices = methodAdvices.get(mi);
+      for (AdviceBinding binding : bindings.values())
       {
-
-         AdviceBinding binding = (AdviceBinding)it.next();
          PointcutMethodMatch pmatch= binding.getPointcut().matchesExecution(advisor, mi);
          
          if (pmatch != null && pmatch.isMatch())
          {
             if (advices == null)
             {
-               advices = new ArrayList();
+               advices = new ArrayList<InterceptorFactory>();
                methodAdvices.put(mi, advices);
             }
             advices.addAll(Arrays.asList(binding.getInterceptorFactories()));
@@ -241,19 +237,16 @@
       }
    }
 
-   protected void bindConstructorAdvice(Constructor mi, Map bindings)
+   protected void bindConstructorAdvice(Constructor<?> mi, Map<String, AdviceBinding> bindings)
    {
-      Iterator it = bindings.values().iterator();
-      ArrayList advices = (ArrayList)constructorAdvices.get(mi);
-      while (it.hasNext())
+      ArrayList<InterceptorFactory> advices = constructorAdvices.get(mi);
+      for (AdviceBinding binding : bindings.values())
       {
-
-         AdviceBinding binding = (AdviceBinding)it.next();
          if (binding.getPointcut().matchesExecution(advisor, mi))
          {
             if (advices == null)
             {
-               advices = new ArrayList();
+               advices = new ArrayList<InterceptorFactory>();
                constructorAdvices.put(mi, advices);
             }
             advices.addAll(Arrays.asList(binding.getInterceptorFactories()));
@@ -265,20 +258,16 @@
       }
    }
 
-   protected void bindFieldGetAdvice(Field mi, Map bindings)
+   protected void bindFieldGetAdvice(Field mi, Map<String, AdviceBinding> bindings)
    {
-      Map repositoryBindings = advisor.getManager().getBindings();
-      Iterator it = repositoryBindings.values().iterator();
-      ArrayList advices = (ArrayList)fieldReadAdvices.get(mi);
-      while (it.hasNext())
+      ArrayList<InterceptorFactory> advices = fieldReadAdvices.get(mi);
+      for (AdviceBinding binding : bindings.values())
       {
-
-         AdviceBinding binding = (AdviceBinding)it.next();
          if (binding.getPointcut().matchesGet(advisor, mi))
          {
             if (advices == null)
             {
-               advices = new ArrayList();
+               advices = new ArrayList<InterceptorFactory>();
                fieldReadAdvices.put(mi, advices);
             }
             advices.addAll(Arrays.asList(binding.getInterceptorFactories()));
@@ -290,20 +279,16 @@
       }
    }
 
-   protected void bindFieldSetAdvice(Field mi, Map bindings)
+   protected void bindFieldSetAdvice(Field mi, Map<String, AdviceBinding> bindings)
    {
-      Map repositoryBindings = advisor.getManager().getBindings();
-      Iterator it = repositoryBindings.values().iterator();
-      ArrayList advices = (ArrayList)fieldWriteAdvices.get(mi);
-      while (it.hasNext())
+      ArrayList<InterceptorFactory> advices = fieldWriteAdvices.get(mi);
+      for (AdviceBinding binding : bindings.values())
       {
-
-         AdviceBinding binding = (AdviceBinding)it.next();
          if (binding.getPointcut().matchesSet(advisor, mi))
          {
             if (advices == null)
             {
-               advices = new ArrayList();
+               advices = new ArrayList<InterceptorFactory>();
                fieldWriteAdvices.put(mi, advices);
             }
             advices.addAll(Arrays.asList(binding.getInterceptorFactories()));

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java	2008-03-13 12:57:14 UTC (rev 70816)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinpointStatusUpdate.java	2008-03-13 13:05:33 UTC (rev 70817)
@@ -24,6 +24,8 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.jboss.aop.MethodInfo;
+
 import javassist.CtClass;
 
 /**
@@ -65,25 +67,25 @@
        * The field read joinpoints.
        * A collection of <code>java.lang.Integer</code>.
        */
-      public Collection fieldReads;
+      public Collection<Integer> fieldReads;
 
       /**
        * The field write joinponts.
        * A collection of <code>java.lang.Integer</code>.
        */
-      public Collection fieldWrites;
+      public Collection<Integer> fieldWrites;
       
       /**
        * The constructor execution joinpoints.
        * A collection of <code>java.lang.Integer</code>.
        */
-      public Collection constructorExecutions;
+      public Collection<Integer> constructorExecutions;
       
       /**
        * The method execution joinpoints.
-       * A collection of <code>org.jboss.aop.MethodJoinPoint</code>.
+       * A collection of <code>org.jboss.aop.MethodInfo</code>.
        */
-      public Collection methodExecutions;
+      public Collection<MethodInfo> methodExecutions;
       
       /**
        * Constructor.
@@ -95,10 +97,10 @@
        * instance may contain.
        */
       public ClassJoinpoints(int fields, int constructors, int methods) {
-         this.fieldReads = new ArrayList(fields);
-         this.fieldWrites = new ArrayList(fields);
-         this.constructorExecutions = new ArrayList(constructors);
-         this.methodExecutions = new ArrayList(methods);
+         this.fieldReads = new ArrayList<Integer>(fields);
+         this.fieldWrites = new ArrayList<Integer>(fields);
+         this.constructorExecutions = new ArrayList<Integer>(constructors);
+         this.methodExecutions = new ArrayList<MethodInfo>(methods);
       }     
       
       /**




More information about the jboss-cvs-commits mailing list