summaryrefslogtreecommitdiffstats
path: root/tests/java5/varargs/ajdk/AJDKExamples.aj
diff options
context:
space:
mode:
Diffstat (limited to 'tests/java5/varargs/ajdk/AJDKExamples.aj')
-rw-r--r--tests/java5/varargs/ajdk/AJDKExamples.aj31
1 files changed, 31 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) {}
+}
+