[jboss-cvs] JBossAS SVN: r103038 - in projects/aop/trunk/aop/src: test/java/org/jboss/test/aop/synthetic and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 26 08:13:25 EDT 2010


Author: kabir.khan at jboss.com
Date: 2010-03-26 08:13:24 -0400 (Fri, 26 Mar 2010)
New Revision: 103038

Modified:
   projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
   projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/synthetic/SyntheticTestCase.java
Log:
[JBAOP-782] Make sure _setInstanceAdvisor() is synthetic

Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-26 12:09:38 UTC (rev 103037)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-26 12:13:24 UTC (rev 103038)
@@ -659,13 +659,10 @@
       
       // check if the clazz already contain a _setInstanceAdvisor method
       // if it do, do not add another one.
-      //why doesnt this work..??
-      //if(clazz.getMethod("_setInstanceAdvisor", "org.jboss.aop.InstanceAdvisor") != null)
-      //workaround:
       CtMethod[] methodz = clazz.getMethods();
       boolean setInstanceAdvisorFound = false;
       for(CtMethod m : methodz)
-         if(m.getName().equals("_setInstanceAdvisor"))
+         if(m.getName().equals("_setInstanceAdvisor") && !m.getDeclaringClass().isInterface())
          {
             setInstanceAdvisorFound = true;
          }

Modified: projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/synthetic/SyntheticTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/synthetic/SyntheticTestCase.java	2010-03-26 12:09:38 UTC (rev 103037)
+++ projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/synthetic/SyntheticTestCase.java	2010-03-26 12:13:24 UTC (rev 103038)
@@ -163,6 +163,37 @@
             assertTrue(method.toString() + " should be synthetic", method.isSynthetic());
          }
       }
+      
+      for (Field field : pojo.getClass().getFields())
+      {
+         if (field.getDeclaringClass() == Object.class)
+            continue;
+         
+         if (fieldsAndMethods.contains(field.getName()))
+         {
+            assertFalse(field.toString() + " should not be synthetic", field.isSynthetic());
+         }
+         else
+         {
+            assertTrue(field.toString() + " should be synthetic", field.isSynthetic());
+         }
+      }
+      
+      for (Method method : pojo.getClass().getMethods())
+      {
+         if (method.getDeclaringClass() == Object.class)
+            continue;
+         
+         if (fieldsAndMethods.contains(method.getName()))
+         {
+            assertFalse(method.toString() + " should not be synthetic", method.isSynthetic());
+         }
+         else
+         {
+            assertTrue(method.toString() + " should be synthetic", method.isSynthetic());
+         }
+      }
+      
    }
    
    public void testCallerSynthetic() throws Exception
@@ -192,7 +223,30 @@
             assertTrue(method.toString() + " should be synthetic", method.isSynthetic());
          }
       }
-}
+      
+      for (Field field : caller.getClass().getFields())
+      {
+         if (field.getDeclaringClass() == Object.class)
+            continue;
+         
+         assertTrue(field.toString() + " should be synthetic", field.isSynthetic());
+      }
+      for (Method method : caller.getClass().getMethods())
+      {
+         if (method.getDeclaringClass() == Object.class)
+            continue;
+         
+         if (method.getName().equals("call"))
+         {
+            assertFalse(method.toString() + " should not be synthetic", method.isSynthetic());
+         }
+         else
+         {
+            assertTrue(method.toString() + " should be synthetic", method.isSynthetic());
+         }
+      }
+      
+   }
    
    public void testProxiedSynthetic() throws Exception
    {
@@ -237,7 +291,31 @@
             assertTrue(method.toString() + " should be synthetic", method.isSynthetic());
          }
       }
-      
+
+      for (Field field : proxied.getClass().getFields())
+      {
+         if (field.getDeclaringClass() == Object.class)
+            continue;
+         if (field.getName().equals("GUID"))
+            continue;
+         
+         assertTrue(field.toString() + " should be synthetic", field.isSynthetic());
+      }
+      for (Method method : proxied.getClass().getMethods())
+      {
+         if (method.getDeclaringClass() == Object.class)
+            continue;
+         
+         if (fieldsAndMethods.contains(method.getName()))
+         {
+            assertFalse(method.toString() + " should not be synthetic", method.isSynthetic());
+         }
+         else
+         {
+            assertTrue(method.toString() + " should be synthetic", method.isSynthetic());
+         }
+      }
+
    }
 
 }




More information about the jboss-cvs-commits mailing list