[jboss-cvs] JBossAS SVN: r103045 - in projects/aop/branches/Branch_2_2/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 10:30:29 EDT 2010


Author: stalep
Date: 2010-03-26 10:30:29 -0400 (Fri, 26 Mar 2010)
New Revision: 103045

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


Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-26 14:29:07 UTC (rev 103044)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-26 14:30:29 UTC (rev 103045)
@@ -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;
          }
@@ -1085,4 +1082,4 @@
          return infoName;
       }
    }
-}
\ No newline at end of file
+}

Modified: projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/synthetic/SyntheticTestCase.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/synthetic/SyntheticTestCase.java	2010-03-26 14:29:07 UTC (rev 103044)
+++ projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/synthetic/SyntheticTestCase.java	2010-03-26 14:30:29 UTC (rev 103045)
@@ -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