From: aclement Date: Mon, 8 Dec 2008 19:35:40 +0000 (+0000) Subject: 257833: test and fix: anno atArgs and null X-Git-Tag: V1_6_3rc1~43 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2e2be8e6396445755df423a96fc2decdae7b8b40;p=aspectj.git 257833: test and fix: anno atArgs and null --- diff --git a/tests/bugs163/pr257833/NotNull.java b/tests/bugs163/pr257833/NotNull.java new file mode 100644 index 000000000..47950d02c --- /dev/null +++ b/tests/bugs163/pr257833/NotNull.java @@ -0,0 +1,3 @@ +package patterntesting.check.runtime; + +public @interface NotNull { } diff --git a/tests/bugs163/pr257833/NotNullAspect.java b/tests/bugs163/pr257833/NotNullAspect.java new file mode 100644 index 000000000..f5e8654d7 --- /dev/null +++ b/tests/bugs163/pr257833/NotNullAspect.java @@ -0,0 +1,15 @@ +package patterntesting.check.runtime; + +public aspect NotNullAspect { + + pointcut ctorWithNotNullArg() : + execution(*..*.new(*)) && @args(NotNull); + + before() : ctorWithNotNullArg() { + Object[] args = thisJoinPoint.getArgs(); + if (args[0] == null) { + throw new AssertionError("@NotNull constraint violated"); + } + } + +} diff --git a/tests/bugs163/pr257833/NotNullTest.java b/tests/bugs163/pr257833/NotNullTest.java new file mode 100644 index 000000000..f3e64c73b --- /dev/null +++ b/tests/bugs163/pr257833/NotNullTest.java @@ -0,0 +1,21 @@ +package patterntesting.check.runtime; + + +public class NotNullTest { + + private String s2; + private static final String nullString = null; + + public NotNullTest() { + } + + public NotNullTest(@NotNull String s) { + s2 = s; + } + + public static void main(String []argv) { + new NotNullTest("something"); + new NotNullTest(nullString); + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java index a403dffa3..ec6d91012 100644 --- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java @@ -28,6 +28,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testNonNullAtArgs_pr257833() { + runTest("param annos and at args"); + } + // public void testAtAspectJDecp_pr164016() { // runTest("ataspectj decp"); // } diff --git a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml index eb1034a60..9c65c6f95 100644 --- a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml +++ b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml @@ -191,6 +191,13 @@ + + + + + + +