]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 148727 - reverse synthetic changes for aspectOf() and hasAspect()
authoraclement <aclement>
Wed, 28 Jun 2006 09:16:01 +0000 (09:16 +0000)
committeraclement <aclement>
Wed, 28 Jun 2006 09:16:01 +0000 (09:16 +0000)
tests/bugs152/pr148727/Asp.aj [new file with mode: 0644]
tests/bugs152/pr148727/Client.java [new file with mode: 0644]
tests/features152/synthetic/TheWholeShow.aj
tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
weaver/src/org/aspectj/weaver/NameMangler.java

diff --git a/tests/bugs152/pr148727/Asp.aj b/tests/bugs152/pr148727/Asp.aj
new file mode 100644 (file)
index 0000000..446fb58
--- /dev/null
@@ -0,0 +1,2 @@
+public aspect Asp {
+}
diff --git a/tests/bugs152/pr148727/Client.java b/tests/bugs152/pr148727/Client.java
new file mode 100644 (file)
index 0000000..2ced473
--- /dev/null
@@ -0,0 +1,7 @@
+public class Client {
+    public static void main(String argz[]) {
+        if (!Asp.hasAspect()) 
+          throw new RuntimeException("ou est le aspect?");
+        System.out.println("Can call aspectOf? "+Asp.aspectOf());
+    }
+}
index d1e032e8bfb91724eadecef93a57956a1db4696f..7045c819268a4172accbdc59a6a1c1ac3404b769 100644 (file)
@@ -58,6 +58,7 @@ public class TheWholeShow {
     for (Method m : ms) {
       if (!m.isSynthetic()) {
         String name = m.getName();
+        if (name.equals("aspectOf") || name.equals("hasAspect")) continue;
         if ( ! (name.startsWith("ajc$before") || name.startsWith("ajc$after") || name.startsWith("ajc$around")  ||
              name.startsWith("ajc$interMethod$"))) {
           System.err.println("Found non-synthetic method: " + m.getName() + " in " + c.getName());
index e53fc4f4a724fd93c095b9883a754379908e43c7..c60ba90b4271fcfe37c3658ab763e292a8bb879b 100644 (file)
@@ -35,6 +35,8 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 //  public void testItdCallingGenericMethod_pr145391_2() { runTest("itd calling generic method - 2");}
 //  public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");}
 //  public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");}
+  public void testSeparateCallAspectOf_pr148727() { runTest("separate compilation calling aspectOf and hasAspect"); }
+  public void testIntegratedCallAspectOf_pr148727() { runTest("integrated compilation calling aspectOf and hasAspect"); }
   public void testFreakyNewArrayJoinpoint_pr148786() { runTest("freaky new array joinpoint"); }
   public void testPrivilegeGeneric_pr148545() { runTest("nosuchmethoderror for privileged aspect");}
   public void testPrivilegeGeneric_pr148545_2() { runTest("nosuchmethoderror for privileged aspect - 2");}
@@ -97,6 +99,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testAspectLibrariesAndASM_pr135001() { runTest("aspect libraries and asm");}
   public void testStackOverflow_pr136258() { runTest("stack overflow");}
   public void testIncorrectOverridesEvaluation13() { runTest("incorrect overrides evaluation - 1.3"); }
+//  public void testIncorrectOverridesEvaluation14() { runTest("incorrect overrides evaluation - 1.4"); }
   public void testIncorrectOverridesEvaluation15() { runTest("incorrect overrides evaluation - 1.5"); }
   public void testAtWithinCodeBug_pr138798() { runTest("atWithinCodeBug"); }
   public void testReferencePCutInDeclareWarning_pr138215() { runTest("Reference pointcut fails inside @DeclareWarning");}
index cbff0e3d1277f738efd3d7c38a0784113f3534c9..6fed5f9dba67c85f94a5818daa5ef410639437e3 100644 (file)
       </compile>
     </ajc-test>
     
+    <ajc-test dir="bugs152/binaryDecp" title="incorrect overrides evaluation - 1.4">
+      <compile files="IsItSynthetic.java" options="-1.5"/>
+      <compile files="Top.java" options="-source 1.5 -target 1.5" outjar="a.jar"/>
+      <compile files="Bottom.java" classpath="$sandbox/a.jar" options="-source 1.4 -target 1.4" outjar="b.jar"/>
+      <compile files="Middle.java" classpath="$sandbox/a.jar" options="-source 1.4 -target 1.4" outjar="c.jar"/>
+      <compile files="X2.aj" classpath="$sandbox/a.jar;$sandbox/b.jar;$sandbox/c.jar" options="-Xlint:ignore" outjar="x.jar"/>
+      <run class="Bottom" classpath="a.jar;b.jar;c.jar;x.jar" ltw="aop.xml"/>
+        <!--message kind="weave" text="Setting superclass of type 'Bottom' (Bottom.java) to 'Middle' (X2.aj)"/-->
+    </ajc-test>
+    
     <ajc-test dir="bugs152/binaryDecp" title="incorrect overrides evaluation - 1.5">
       <compile files="SubClassLoader.java,SubSubClassLoader.java" options="-1.5" outjar="lib.jar"/>
       <compile files="X.aj" inpath="lib.jar" options="-showWeaveInfo">
           </stderr>
         </run>
     </ajc-test>    
+    
+    <ajc-test dir="bugs152/pr148727"  pr="148727"
+               title="integrated compilation calling aspectOf and hasAspect"  >
+           <compile files="Asp.aj, Client.java" options="-source 1.4"/>
+        <run class="Client">
+          <stdout>
+            <line text="Can call aspectOf? Asp@"/>
+          </stdout>
+        </run>
+    </ajc-test>
+
+    <ajc-test dir="bugs152/pr148727"  pr="148727"
+               title="separate compilation calling aspectOf and hasAspect"  >
+           <compile files="Asp.aj" outjar="asp.jar"/>
+           <compile files="Client.java" classpath="asp.jar" options="-source 1.4"/>
+        <run class="Client">
+          <stdout>
+            <line text="Can call aspectOf? Asp@"/>
+          </stdout>
+        </run>
+    </ajc-test>
 </suite>
\ No newline at end of file
index 73d349fa6553f5bc2bf3f232e7fb6b3aeb485983..faf06df83914a679a0c3e6dede462652c55635f8 100644 (file)
@@ -71,11 +71,12 @@ public class NameMangler {
                else if (methodName.indexOf("_aroundBody") != -1) {
                        return true;
                }
-               else if (declaredInAspect) {
-                       if (methodName.equals("aspectOf") || methodName.equals("hasAspect")) {
-                               return true;
-                       }
-               } 
+// these aren't the droids you're looking for...move along...... pr148727
+//             else if (declaredInAspect) {
+//                     if (methodName.equals("aspectOf") || methodName.equals("hasAspect")) {
+//                             return true;
+//                     }
+//             } 
                return false;
        }