diff options
author | aclement <aclement> | 2004-08-27 14:39:46 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-08-27 14:39:46 +0000 |
commit | a5330382082fbb28a761421037901d6b277e966f (patch) | |
tree | 7a0193a2bc73f9331a17de6dcc9e53502a787b60 /tests | |
parent | 5e0876580b0e95dd06ca4342e233f9a5dceb33a5 (diff) | |
download | aspectj-a5330382082fbb28a761421037901d6b277e966f.tar.gz aspectj-a5330382082fbb28a761421037901d6b277e966f.zip |
tests for Bugzilla Bug 70404
passing null to array arguments confuzes static join point signature.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs/pr70404/Main.java | 15 | ||||
-rw-r--r-- | tests/bugs/pr70404/Main2.java | 13 | ||||
-rw-r--r-- | tests/bugs/pr70404/MainAspect.java | 19 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java | 9 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml | 17 |
5 files changed, 69 insertions, 4 deletions
diff --git a/tests/bugs/pr70404/Main.java b/tests/bugs/pr70404/Main.java new file mode 100644 index 000000000..01cff7a87 --- /dev/null +++ b/tests/bugs/pr70404/Main.java @@ -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 index 000000000..c18eec46c --- /dev/null +++ b/tests/bugs/pr70404/Main2.java @@ -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 index 000000000..ef1711d2d --- /dev/null +++ b/tests/bugs/pr70404/MainAspect.java @@ -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(""); + } + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java b/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java index 0ecb6e6dc..98c1b8d5d 100644 --- a/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java @@ -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)"); + } + } diff --git a/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml b/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml index e4b3a793c..dedc94112 100644 --- a/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml +++ b/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml @@ -403,8 +403,7 @@ <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"> @@ -432,5 +431,15 @@ <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> |