[jboss-cvs] JBossAS SVN: r61038 - projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 1 19:17:17 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-03-01 19:17:17 -0500 (Thu, 01 Mar 2007)
New Revision: 61038

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
Log:
Add test to verify that when generating a proxy for to a class, and the class already contains the methods from the introduced interface that the original interface method is called.

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java	2007-03-02 00:11:45 UTC (rev 61037)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java	2007-03-02 00:17:17 UTC (rev 61038)
@@ -456,7 +456,6 @@
    private void addMethodsAndMixins()throws Exception
    {
       HashSet addedMethods = new HashSet();
-
       createMixinsAndIntroductions(addedMethods);
       createProxyMethods(addedMethods);
    }
@@ -492,6 +491,10 @@
             }
          }
          
+         //Now that we have added the mixins, add all the proxies methods to the added methods set
+         HashMap allMethods = JavassistMethodHashing.getDeclaredMethodMap(proxy);
+         addedMethods.addAll(allMethods.keySet());
+
          createMixins(addedMethods, mixes, addedInterfaces, implementedInterfaces);
          createIntroductions(addedMethods, intfs, addedInterfaces, implementedInterfaces);
       }
@@ -592,7 +595,6 @@
                CtMethod newMethod = CtNewMethod.make(methods[m].getReturnType(), methods[m].getName(), methods[m].getParameterTypes(), methods[m].getExceptionTypes(), code, proxy);
                newMethod.setModifiers(Modifier.PUBLIC);
                proxy.addMethod(newMethod);
-               //System.out.println("=====> Created mixin method " + methods[m].getName());
             }
 
             proxy.addInterface(intfClass);
@@ -684,7 +686,7 @@
             Long hash = new Long(JavassistMethodHashing.methodHash(methods[m]));
             if (mixinMethods.contains(hash)) continue;
             if (addedMethods.contains(hash)) continue;
-            
+
             mixinMethods.add(hash);
             addedMethods.add(hash);
             String aopReturnStr = (methods[m].getReturnType().equals(CtClass.voidType)) ? "" : "return ($r)";
@@ -708,7 +710,6 @@
             CtMethod newMethod = CtNewMethod.make(methods[m].getReturnType(), methods[m].getName(), methods[m].getParameterTypes(), methods[m].getExceptionTypes(), code, proxy);
             newMethod.setModifiers(Modifier.PUBLIC);
             proxy.addMethod(newMethod);
-            //System.out.println("=====> Created introduced method " + methods[m].getName());
          }
 
          proxy.addInterface(intfClass);




More information about the jboss-cvs-commits mailing list