]> source.dussan.org Git - aspectj.git/commitdiff
tests for Bugzilla Bug 70404
authoraclement <aclement>
Fri, 27 Aug 2004 14:39:46 +0000 (14:39 +0000)
committeraclement <aclement>
Fri, 27 Aug 2004 14:39:46 +0000 (14:39 +0000)
   passing null to array arguments confuzes static join point signature.

tests/bugs/pr70404/Main.java [new file with mode: 0644]
tests/bugs/pr70404/Main2.java [new file with mode: 0644]
tests/bugs/pr70404/MainAspect.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java
tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml

diff --git a/tests/bugs/pr70404/Main.java b/tests/bugs/pr70404/Main.java
new file mode 100644 (file)
index 0000000..01cff7a
--- /dev/null
@@ -0,0 +1,15 @@
+package dk.infimum.aspectjtest;
+public class Main {
+    public static void main(String[] args) {
+      Main obj = new Main();
+      //Main m[] = new Main[3];
+      
+      // swap following lines to change behavior
+      obj.test(null, null);
+      obj.test(null, new Main[]{});
+    }
+    void test(Main dummy, Main[] dummy2) {}
+}
diff --git a/tests/bugs/pr70404/Main2.java b/tests/bugs/pr70404/Main2.java
new file mode 100644 (file)
index 0000000..c18eec4
--- /dev/null
@@ -0,0 +1,13 @@
+package dk.infimum.aspectjtest;
+public class Main2 {
+    public static void main(String[] args) {
+      Main2 obj = new Main2();
+      // swap following lines to change behavior
+      obj.test(null, new Main2[]{});
+      obj.test(null, null);
+    }
+    void test(Main2 dummy, Main2[] dummy2) {}
+}
diff --git a/tests/bugs/pr70404/MainAspect.java b/tests/bugs/pr70404/MainAspect.java
new file mode 100644 (file)
index 0000000..ef1711d
--- /dev/null
@@ -0,0 +1,19 @@
+import org.aspectj.lang.reflect.MethodSignature;
+public aspect MainAspect {
+    pointcut testcall(): execution(* test*(..));
+    before(): testcall() {
+      MethodSignature sig = 
+        (MethodSignature) thisJoinPointStaticPart.getSignature();
+      System.out.println(sig);
+      Class[] params = sig.getParameterTypes();
+      for(int i=0;i<params.length;i++) {
+        Class cls = params[i];
+        String name = cls.getName();
+        System.out.println(" - " + name);
+        if (name.indexOf("ClassNotFoundException")!=-1) throw new RuntimeException("");
+      }
+    }
+}
index 0ecb6e6dc98dea01ebe14f4c74aeb68b1ef11212..98c1b8d5d53ef1f93df80b353d0c3980d7d7ae9b 100644 (file)
@@ -279,5 +279,14 @@ public class Ajc121Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void test053_bogusMessage2() {
     runTest("Bogus error message: The abstract method ajc$pointcut$$tracingScope$a2 in type Tracing can only be defined by an abstract class (2)");
   }
+  
+  public void test054_cnfe() {
+        runTest("passing null to array arguments confuzes static join point signature. (1)");
+  }
+
+  public void test055_cnfe() {
+    runTest("passing null to array arguments confuzes static join point signature. (2)");
+  }
+   
 }
 
index e4b3a793c94ab8883b98ea3388f4c95b6fcfcbaa..dedc941123b5ae6cf1922d82b7c247ea1ebdd6e9 100644 (file)
                        <message kind="error" line="13" text="abstract intertype method declaration 'void PublicPackage.world()' on interface PublicPackage must be declared public (compiler limitation)"/>
                </compile>
        </ajc-test>
-               
-       
+
        <ajc-test dir="bugs/pr72531" pr="72531"
                title="declare warning warns at wrong points">
                <compile files="de/rohith/HelloWorld.java,de/rohith/HelloWorldAspect.java,de/rohith/PrinterWorld.java">
             <message kind="error" line="2" text="The abstract pointcut tracingScope can only be defined in an aspect"/>
           </compile>
     </ajc-test>
-    
-       
\ No newline at end of file
+       
+       <ajc-test dir="bugs/pr70404" pr="70404" 
+               title="passing null to array arguments confuzes static join point signature. (1)">
+         <compile files="Main.java,MainAspect.java"/>
+         <run class="dk.infimum.aspectjtest.Main"/>
+       </ajc-test>
+
+       <ajc-test dir="bugs/pr70404" pr="70404" 
+               title="passing null to array arguments confuzes static join point signature. (2)">
+         <compile files="Main2.java,MainAspect.java"/>
+         <run class="dk.infimum.aspectjtest.Main2"/>
+       </ajc-test>