[jboss-cvs] JBossAS SVN: r88420 - in projects/aop/trunk/aop: src/main/java/org/jboss/aop/pointcut and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 8 07:27:33 EDT 2009


Author: flavia.rainone at jboss.com
Date: 2009-05-08 07:27:33 -0400 (Fri, 08 May 2009)
New Revision: 88420

Modified:
   projects/aop/trunk/aop/2.0.x-compliance-tests.xml
   projects/aop/trunk/aop/src/main/java/org/jboss/aop/pointcut/Util.java
   projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/rebuildingchain/ConstructorExecutionSyncThread.java
Log:
[JBAOP-722] Util.matchesParameters methods were changed, so that now the constructor of the specified scenario will be treated as being the default one during matching.

Modified: projects/aop/trunk/aop/2.0.x-compliance-tests.xml
===================================================================
--- projects/aop/trunk/aop/2.0.x-compliance-tests.xml	2009-05-08 10:12:51 UTC (rev 88419)
+++ projects/aop/trunk/aop/2.0.x-compliance-tests.xml	2009-05-08 11:27:33 UTC (rev 88420)
@@ -394,7 +394,7 @@
       <antcall target="_base-jdk50-tests_2.0.x" inheritRefs="true">
          <param name="caller" value="javaagent-genadvisor-tests_2.0.x"/>
          <param name="test-target" value="_run-javaagent-test_2.0.x"/>
-         <param name="exclude" value="**/constructortarget/*.class"/>
+         <param name="exclude" value="**/constructortarget/*"/>
       </antcall>
    </target>
 
@@ -636,16 +636,21 @@
       </condition>
       <condition property="instrumentor" value="org.jboss.aop.instrument.ClassicInstrumentor">
          <not>
-            <equals arg1="${caller}" arg2="precompiled-genadvisor-tests_2.0.x"/>
+            <equals arg1="${caller}" arg2="precompiled-tests_2.0.x"/>
          </not>
       </condition>
       <condition property="instrumentor" value="org.jboss.aop.instrument.GeneratedAdvisorInstrumentor">
          <equals arg1="${caller}" arg2="precompiled-genadvisor-tests_2.0.x"/>
       </condition>
 
-      <echo>Compiling ${test} with optimized=${optimized} and instrumentor ${instrumentor}</echo>
+      <condition property="newtest" value="nonexistent" else="${test}">
+         <equals arg1="${test}" arg2="rebuildingchain"/>
+      </condition>
+      
+      <echo>Compiling ${newtest} with optimized=${optimized} and instrumentor ${instrumentor}</echo>
 
       <!-- aopc -->
+      <echo>EXCLUDES:"${exclude}"</echo>
       <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="aopc.task.classpath.2.0.x"/>
       <aopc optimized="${optimized}" compilerclasspathref="aopc.task.classpath.2.0.x">
          <classpath refid="aopc.task.classpath.2.0.x"/>
@@ -654,7 +659,7 @@
          <sysproperty key="jboss.aop.instrumentor" value="${instrumentor}"/>
          <sysproperty key="java.io.tmpdir" value="${aopc.tmpdir}"/>
          <src path="${build.tests.classes}"/>
-         <include name="org/jboss/test/aop/${test}/**"/>
+         <include name="org/jboss/test/aop/${newtest}/**"/>
          <exclude name="${exclude}"/>
          <aopclasspath path="${build.tests.classes}/org/jboss/test/aop/${test}"/>
       </aopc>
@@ -709,6 +714,7 @@
                <exclude name="${exclude}"/>
 
                <!-- These are not test cases, and so they will fail when junit tries to run them. Should really rename all tests to *TestCase -->
+               <exclude name="org/jboss/test/aop/rebuildingchain/*.class"/>
                <exclude name="org/jboss/test/aop/reflection/ReflectionAspectTester.class"/>
                <exclude name="org/jboss/test/aop/basic/POJOAspectTester.class"/>
             </fileset>

Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/pointcut/Util.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/pointcut/Util.java	2009-05-08 10:12:51 UTC (rev 88419)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/pointcut/Util.java	2009-05-08 11:27:33 UTC (rev 88420)
@@ -668,6 +668,12 @@
       if (node.isAnyParameters()) return true;
       try
       {
+      	// JBAOP-722
+         CtClass enclosingClass = ctConstructor.getDeclaringClass().getDeclaringClass();
+         if (enclosingClass != null && ctConstructor.getParameterTypes().length == 1 && ctConstructor.getParameterTypes()[0].getName().startsWith(enclosingClass.getName() + '$'))
+         {
+            return Util.matchesParameters(advisor, node.hasAnyZeroOrMoreParameters(), node.getParameters(), new CtClass[0]);
+         }
          CtClass[] params = ctConstructor.getParameterTypes();
          return Util.matchesParameters(advisor, node.hasAnyZeroOrMoreParameters(), node.getParameters(), params);
       }
@@ -687,7 +693,16 @@
    public static boolean matchesParameters(Advisor advisor, ASTConstructor node, Constructor<?> con) 
    {
       if (node.isAnyParameters()) return true;
-
+      // JBAOP-722
+      Class<?> enclosingClass = con.getDeclaringClass().getDeclaringClass();
+      if (enclosingClass != null && con.getParameterTypes().length == 1 && con.getParameterTypes()[0].getName().startsWith(enclosingClass.getName()))
+      {
+         Class<?> parameterType = con.getParameterTypes()[0];
+         if (parameterType.getDeclaringClass().equals(enclosingClass))
+         {
+            return Util.matchesParameters(advisor, node.hasAnyZeroOrMoreParameters(), node.getParameters(), new CtClass[0]);
+         }
+      }
       return matchesParameters(advisor, node.hasAnyZeroOrMoreParameters(), node.getParameters(), con.getParameterTypes());
    }
 

Modified: projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/rebuildingchain/ConstructorExecutionSyncThread.java
===================================================================
--- projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/rebuildingchain/ConstructorExecutionSyncThread.java	2009-05-08 10:12:51 UTC (rev 88419)
+++ projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/rebuildingchain/ConstructorExecutionSyncThread.java	2009-05-08 11:27:33 UTC (rev 88420)
@@ -36,9 +36,5 @@
       new Pojo();
    }
    
-   private static class Pojo
-   {
-      // TODO JBAOP-722 Remove this constructor.
-      public Pojo() {}
-   }
+   private static class Pojo {}
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list