aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/generics/ajdk/ArgsExamples.aj
diff options
context:
space:
mode:
Diffstat (limited to 'tests/java5/generics/ajdk/ArgsExamples.aj')
-rw-r--r--tests/java5/generics/ajdk/ArgsExamples.aj63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/java5/generics/ajdk/ArgsExamples.aj b/tests/java5/generics/ajdk/ArgsExamples.aj
new file mode 100644
index 000000000..833d9d154
--- /dev/null
+++ b/tests/java5/generics/ajdk/ArgsExamples.aj
@@ -0,0 +1,63 @@
+import java.util.*;
+
+class C {
+
+ public void foo(List<String> listOfStrings) {}
+
+ public void bar(List<Double> listOfDoubles) {}
+
+ public void goo(List<? extends Number> listOfSomeNumberType) {}
+
+}
+
+aspect A {
+
+ before(List<Double> listOfDoubles) : execution(* C.*(..)) && args(listOfDoubles) {
+ for (Double d : listOfDoubles) {
+ // do something
+ }
+ }
+
+ @org.aspectj.lang.annotation.SuppressAjWarnings
+ before(List<Double> listOfDoubles) : execution(* C.*(..)) && args(listOfDoubles) {
+ for (Double d : listOfDoubles) {
+ // do something
+ }
+ }
+
+ @org.aspectj.lang.annotation.SuppressAjWarnings("uncheckedArgument")
+ before(List<Double> listOfDoubles) : execution(* C.*(..)) && args(listOfDoubles) {
+ for (Double d : listOfDoubles) {
+ // do something
+ }
+ }
+
+ before(List<Double> listOfDoubles) : execution(* C.*(List<Double>)) && args(listOfDoubles) {
+ for (Double d : listOfDoubles) {
+ // do something
+ }
+ }
+
+}
+
+public aspect ArgsExamples {
+
+ before() : args(List) && execution(* *(..)) {
+ System.out.println("args(List)");
+ }
+
+ before() : args(List<String>) && execution(* *(..)) {
+ System.out.println("args List of String");
+ }
+
+ before() : args(List<Double>) && execution(* *(..)) {
+ System.out.println("args List of Double");
+ }
+
+ public static void main(String[] args) {
+ C c = new C();
+ c.foo(new ArrayList<String>());
+ c.bar(new ArrayList<Double>());
+ c.goo(new ArrayList<Float>());
+ }
+} \ No newline at end of file