[jboss-cvs] JBossAS SVN: r72951 - projects/aop/trunk/aop/src/main/org/jboss/aop/instrument.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 1 14:39:24 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-05-01 14:39:23 -0400 (Thu, 01 May 2008)
New Revision: 72951

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
Log:
[JBAOP-568] As a first step for removing the class reference from GeneratedClassInfo (keeping the Constructor should be enough),
the initialization of IS_INSTANCE_ADVISOR field has been moved to the constructor. This also avoids the extra cost of setting
the value of this field through reflection.

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2008-05-01 17:44:22 UTC (rev 72950)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2008-05-01 18:39:23 UTC (rev 72951)
@@ -301,12 +301,6 @@
          Object obj = generatedClass.createJoinPointInstance(classloader, info);
          
          joinpointField.set(info.getAdvisor(), obj);
-         if (info.getAdvisor() instanceof InstanceAdvisor)
-         {
-            Field field = generatedClass.getGenerated(classloader).getDeclaredField(IS_FOR_INSTANCE_ADVISOR);
-            SecurityActions.setAccessible(field);
-            field.set(obj, Boolean.TRUE);
-         }
          return obj;
       }
       catch (NoMatchingAdviceException e)
@@ -1087,13 +1081,12 @@
             String cflowInitialization = body.toString();
             body.setLength(0);
             body.append("{super(");
-            if (superCtorParamTypes.length > 0)
+            // it is supposed to contain at least the info object as first parameter
+            //if (superCtorParamTypes.length > 0)
+            body.append("$1");
+            for (int i = 1; i < superCtorParamTypes.length; i++)
             {
-               body.append("$1");
-               for (int i = 1; i < superCtorParamTypes.length; i++)
-               {
-                  body.append(",$" + (i + 1));
-               }
+               body.append(",$" + (i + 1));
             }
             body.append(");");
             body.append(cflowInitialization);
@@ -1104,7 +1097,9 @@
             paramTypes = superCtor.getParameterTypes();
          }
 
-  
+         body.append(IS_FOR_INSTANCE_ADVISOR).append("=($1.getAdvisor() instanceof ");
+         body.append(InstanceAdvisor.class.getName()).append(");");
+         
          //Initialise all the aspects not scoped per_instance or per_joinpoint
          AdviceSetup[] allSetups = setups.getAllSetups();
          for (int i = 0 ; i < allSetups.length ; i++)




More information about the jboss-cvs-commits mailing list