diff options
author | aclement <aclement> | 2004-12-01 18:00:32 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-12-01 18:00:32 +0000 |
commit | d2fb8b7a3122f1e8816cf888b02643d5b31f9c3b (patch) | |
tree | ddeac81962eeb042e82ff449bb4495e302683b73 /tests/java5/covariance/CovBaseProgram02.java | |
parent | 52594375fcd495b3c601642555136b98ee853145 (diff) | |
download | aspectj-d2fb8b7a3122f1e8816cf888b02643d5b31f9c3b.tar.gz aspectj-d2fb8b7a3122f1e8816cf888b02643d5b31f9c3b.zip |
72766: This is covariance support. only missing bit is for dynamic join point matching (marked XXXAJ5 in the code) - thats not a 1.5.0M1 item I dont think...
Diffstat (limited to 'tests/java5/covariance/CovBaseProgram02.java')
-rw-r--r-- | tests/java5/covariance/CovBaseProgram02.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/java5/covariance/CovBaseProgram02.java b/tests/java5/covariance/CovBaseProgram02.java new file mode 100644 index 000000000..43f5a873a --- /dev/null +++ b/tests/java5/covariance/CovBaseProgram02.java @@ -0,0 +1,36 @@ +class Car { + Car() {} +} + +class FastCar extends Car { + FastCar() {} +} + +class Super { + Car getCar() { + return new Car(); + } +} + +class Sub { + FastCar getCar() { + return new FastCar(); + } +} + +public class CovBaseProgram02 { + public static void main(String[] argv) { + new CovBaseProgram02().run(); + } + + public void run() { + Super instance_super = new Super(); + Sub instance_sub = new Sub(); + + Car c1 = instance_super.getCar(); + FastCar c2 = instance_sub.getCar(); + } +} + +// Lemon is a subclass of Car +// Sub is *not* a subclass of Super |