diff options
author | acolyer <acolyer> | 2005-03-09 14:10:39 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-03-09 14:10:39 +0000 |
commit | 82fa47384f23d3ed0cf20b531fff947182b08a84 (patch) | |
tree | f984dac2428b08762c4a6d859e8e321f47fb19c8 /tests/java5/covariance | |
parent | 69845b3545539b7961e8b4a3ef4a5ac416a305bb (diff) | |
download | aspectj-82fa47384f23d3ed0cf20b531fff947182b08a84.tar.gz aspectj-82fa47384f23d3ed0cf20b531fff947182b08a84.zip |
completing the set of AJDK examples coded up as test cases
Diffstat (limited to 'tests/java5/covariance')
-rw-r--r-- | tests/java5/covariance/ajdk/AJDKExamples.aj | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/java5/covariance/ajdk/AJDKExamples.aj b/tests/java5/covariance/ajdk/AJDKExamples.aj new file mode 100644 index 000000000..e7cb02383 --- /dev/null +++ b/tests/java5/covariance/ajdk/AJDKExamples.aj @@ -0,0 +1,47 @@ +public aspect AJDKExamples { + + declare warning : call(* whoAreYou()) + : "call(* whoAreYou())"; + + declare warning : call(* A.whoAreYou()) + : "call(* A.whoAreYou())"; + + declare warning : call(A whoAreYou()) + : "call(A whoAreYou())"; + + declare warning : call(A B.whoAreYou()) + : "call(A B.whoAreYou())"; + + declare warning : call(A+ B.whoAreYou()) + : "call(A+ B.whoAreYou())"; + + declare warning : call(B A.whoAreYou()) + : "call(B A.whoAreYou())"; + + declare warning : call(B whoAreYou()) + : "call(B whoAreYou())"; + + declare warning : call(B B.whoAreYou()) + : "call(B B.whoAreYou())"; + +} + +class A { + public A whoAreYou() { return this; } +} + +class B extends A { + // override A.whoAreYou *and* narrow the return type. + public B whoAreYou() { return this; } +} + +class C { + + public C() { + A a = new A(); + B b = new B(); + a.whoAreYou(); + b.whoAreYou(); + } + +}
\ No newline at end of file |