summaryrefslogtreecommitdiffstats
path: root/tests/java5/varargs
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-03-09 14:10:39 +0000
committeracolyer <acolyer>2005-03-09 14:10:39 +0000
commit82fa47384f23d3ed0cf20b531fff947182b08a84 (patch)
treef984dac2428b08762c4a6d859e8e321f47fb19c8 /tests/java5/varargs
parent69845b3545539b7961e8b4a3ef4a5ac416a305bb (diff)
downloadaspectj-82fa47384f23d3ed0cf20b531fff947182b08a84.tar.gz
aspectj-82fa47384f23d3ed0cf20b531fff947182b08a84.zip
completing the set of AJDK examples coded up as test cases
Diffstat (limited to 'tests/java5/varargs')
-rw-r--r--tests/java5/varargs/ajdk/AJDKExamples.aj31
-rw-r--r--tests/java5/varargs/ajdk/org/xyz/Foo.java5
-rw-r--r--tests/java5/varargs/ajdk/org/xyz/Goo.java5
-rw-r--r--tests/java5/varargs/ajdk/org/xyz/Hoo.java16
4 files changed, 57 insertions, 0 deletions
diff --git a/tests/java5/varargs/ajdk/AJDKExamples.aj b/tests/java5/varargs/ajdk/AJDKExamples.aj
new file mode 100644
index 000000000..422b10ede
--- /dev/null
+++ b/tests/java5/varargs/ajdk/AJDKExamples.aj
@@ -0,0 +1,31 @@
+public aspect AJDKExamples {
+
+ declare warning : call(* org.xyz.*.*(int, String...)) : "call vararg match";
+
+ declare warning : execution(* org.xyz.*.*(Integer...)) : "execution vararg match";
+
+ declare warning : initialization(org.xyz.*.new((Foo || Goo)...)) : "init vararg match";
+
+ declare warning : execution(* *.*(String...)) : "single vararg";
+
+ declare warning : execution(* *.*(String[])) : "single String[]";
+
+ before(int i, String[] ss) : call(* foo(int,String...)) && args(i,ss) {
+ System.out.println("Matched at " + thisJoinPoint);
+ }
+
+ public static void main(String[] args) {
+ X foo = new X();
+ foo.foo(5,"hello");
+ foo.bar(5,new String[]{"hello"});
+ }
+
+}
+
+class X {
+ public void foo(String... ss) {}
+ public void bar(String[] ss) {}
+ public void foo(int i,String... ss) {}
+ public void bar(int i,String[] ss) {}
+}
+
diff --git a/tests/java5/varargs/ajdk/org/xyz/Foo.java b/tests/java5/varargs/ajdk/org/xyz/Foo.java
new file mode 100644
index 000000000..4b10d0af8
--- /dev/null
+++ b/tests/java5/varargs/ajdk/org/xyz/Foo.java
@@ -0,0 +1,5 @@
+package org.xyz;
+
+public class Foo {
+
+}
diff --git a/tests/java5/varargs/ajdk/org/xyz/Goo.java b/tests/java5/varargs/ajdk/org/xyz/Goo.java
new file mode 100644
index 000000000..0c615ebf8
--- /dev/null
+++ b/tests/java5/varargs/ajdk/org/xyz/Goo.java
@@ -0,0 +1,5 @@
+package org.xyz;
+
+public class Goo {
+
+}
diff --git a/tests/java5/varargs/ajdk/org/xyz/Hoo.java b/tests/java5/varargs/ajdk/org/xyz/Hoo.java
new file mode 100644
index 000000000..7ce1c1d73
--- /dev/null
+++ b/tests/java5/varargs/ajdk/org/xyz/Hoo.java
@@ -0,0 +1,16 @@
+package org.xyz;
+
+public class Hoo {
+
+ public Hoo(Foo... foos) {}
+ public Hoo(Goo... goos) {}
+ public Hoo(String... ss) {
+ intStringVar(5,ss);
+ intString(5,ss[0]);
+ }
+
+ void intStringVar(int i, String... ss) {}
+ void intString(int i, String s) {}
+ void integerVar(Integer... is) {}
+
+} \ No newline at end of file