aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163
diff options
context:
space:
mode:
authoraclement <aclement>2008-12-08 19:35:40 +0000
committeraclement <aclement>2008-12-08 19:35:40 +0000
commit2e2be8e6396445755df423a96fc2decdae7b8b40 (patch)
tree448f1671fb2ec1241ecd37f6771412081899c039 /tests/bugs163
parent18f949e82fe7306e556801e1d2af4ded472b856a (diff)
downloadaspectj-2e2be8e6396445755df423a96fc2decdae7b8b40.tar.gz
aspectj-2e2be8e6396445755df423a96fc2decdae7b8b40.zip
257833: test and fix: anno atArgs and null
Diffstat (limited to 'tests/bugs163')
-rw-r--r--tests/bugs163/pr257833/NotNull.java3
-rw-r--r--tests/bugs163/pr257833/NotNullAspect.java15
-rw-r--r--tests/bugs163/pr257833/NotNullTest.java21
3 files changed, 39 insertions, 0 deletions
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);
+ }
+
+}