From d2fb8b7a3122f1e8816cf888b02643d5b31f9c3b Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 1 Dec 2004 18:00:32 +0000 Subject: 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... --- tests/java5/covariance/CovAspect01.aj | 10 ++++++++ tests/java5/covariance/CovAspect02.aj | 10 ++++++++ tests/java5/covariance/CovAspect03.aj | 10 ++++++++ tests/java5/covariance/CovAspect04.aj | 10 ++++++++ tests/java5/covariance/CovAspect05.aj | 10 ++++++++ tests/java5/covariance/CovAspect06.aj | 10 ++++++++ tests/java5/covariance/CovAspect07.aj | 10 ++++++++ tests/java5/covariance/CovAspect08.aj | 16 ++++++++++++ tests/java5/covariance/CovAspect09.aj | 10 ++++++++ tests/java5/covariance/CovAspect10.aj | 10 ++++++++ tests/java5/covariance/CovAspect11.aj | 10 ++++++++ tests/java5/covariance/CovBaseProgram01.jar | Bin 0 -> 1896 bytes tests/java5/covariance/CovBaseProgram01.java | 32 ++++++++++++++++++++++++ tests/java5/covariance/CovBaseProgram02.jar | Bin 0 -> 1888 bytes tests/java5/covariance/CovBaseProgram02.java | 36 +++++++++++++++++++++++++++ tests/java5/covariance/build.xml | 19 ++++++++++++++ 16 files changed, 203 insertions(+) create mode 100644 tests/java5/covariance/CovAspect01.aj create mode 100644 tests/java5/covariance/CovAspect02.aj create mode 100644 tests/java5/covariance/CovAspect03.aj create mode 100644 tests/java5/covariance/CovAspect04.aj create mode 100644 tests/java5/covariance/CovAspect05.aj create mode 100644 tests/java5/covariance/CovAspect06.aj create mode 100644 tests/java5/covariance/CovAspect07.aj create mode 100644 tests/java5/covariance/CovAspect08.aj create mode 100644 tests/java5/covariance/CovAspect09.aj create mode 100644 tests/java5/covariance/CovAspect10.aj create mode 100644 tests/java5/covariance/CovAspect11.aj create mode 100644 tests/java5/covariance/CovBaseProgram01.jar create mode 100644 tests/java5/covariance/CovBaseProgram01.java create mode 100644 tests/java5/covariance/CovBaseProgram02.jar create mode 100644 tests/java5/covariance/CovBaseProgram02.java create mode 100644 tests/java5/covariance/build.xml (limited to 'tests/java5/covariance') diff --git a/tests/java5/covariance/CovAspect01.aj b/tests/java5/covariance/CovAspect01.aj new file mode 100644 index 000000000..fa66dd0c1 --- /dev/null +++ b/tests/java5/covariance/CovAspect01.aj @@ -0,0 +1,10 @@ +aspect CovAspect01 { + + pointcut p(): call(* getCar()); + + before(): p() { + System.out.println("[call(* getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect02.aj b/tests/java5/covariance/CovAspect02.aj new file mode 100644 index 000000000..6a2472a02 --- /dev/null +++ b/tests/java5/covariance/CovAspect02.aj @@ -0,0 +1,10 @@ +aspect CovAspect02 { + + pointcut p(): call(* Super.getCar()); + + before(): p() { + System.out.println("[call(* Super.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect03.aj b/tests/java5/covariance/CovAspect03.aj new file mode 100644 index 000000000..551c4b613 --- /dev/null +++ b/tests/java5/covariance/CovAspect03.aj @@ -0,0 +1,10 @@ +aspect CovAspect03 { + + pointcut p(): call(Car getCar()); + + before(): p() { + System.out.println("[call(Car getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect04.aj b/tests/java5/covariance/CovAspect04.aj new file mode 100644 index 000000000..e8dd00de4 --- /dev/null +++ b/tests/java5/covariance/CovAspect04.aj @@ -0,0 +1,10 @@ +aspect CovAspect04 { + + pointcut p(): call(Car Super.getCar()); + + before(): p() { + System.out.println("[call(Car Super.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect05.aj b/tests/java5/covariance/CovAspect05.aj new file mode 100644 index 000000000..268b179b0 --- /dev/null +++ b/tests/java5/covariance/CovAspect05.aj @@ -0,0 +1,10 @@ +aspect CovAspect05 { + + pointcut p(): call(Car Super.getCar()); + + before(): p() { + System.out.println("[call(Car Super.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect06.aj b/tests/java5/covariance/CovAspect06.aj new file mode 100644 index 000000000..bb4961360 --- /dev/null +++ b/tests/java5/covariance/CovAspect06.aj @@ -0,0 +1,10 @@ +aspect CovAspect06 { + + pointcut p(): call(Car Sub.getCar()); + + before(): p() { + System.out.println("[call(Car Sub.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect07.aj b/tests/java5/covariance/CovAspect07.aj new file mode 100644 index 000000000..67a76825b --- /dev/null +++ b/tests/java5/covariance/CovAspect07.aj @@ -0,0 +1,10 @@ +aspect CovAspect07 { + + pointcut p(): call(Car+ Sub.getCar()); + + before(): p() { + System.out.println("[call(Car+ Sub.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect08.aj b/tests/java5/covariance/CovAspect08.aj new file mode 100644 index 000000000..5920981dc --- /dev/null +++ b/tests/java5/covariance/CovAspect08.aj @@ -0,0 +1,16 @@ +aspect CovAspect08 { + + pointcut p1(): call(FastCar getCar()); + + before(): p1() { + System.out.println("[call(FastCar getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + + pointcut p2(): call(FastCar Sub.getCar()); + + before(): p2() { + System.out.println("[call(FastCar Sub.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect09.aj b/tests/java5/covariance/CovAspect09.aj new file mode 100644 index 000000000..6a3497048 --- /dev/null +++ b/tests/java5/covariance/CovAspect09.aj @@ -0,0 +1,10 @@ +aspect CovAspect09 { + + pointcut p1(): call(FastCar Super.getCar()); + + before(): p1() { + System.out.println("[call(FastCar Super.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect10.aj b/tests/java5/covariance/CovAspect10.aj new file mode 100644 index 000000000..158a3e1e2 --- /dev/null +++ b/tests/java5/covariance/CovAspect10.aj @@ -0,0 +1,10 @@ +aspect CovAspect10 { + + pointcut p1(): call(Car+ getCar()); + + before(): p1() { + System.out.println("[call(Car+ getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovAspect11.aj b/tests/java5/covariance/CovAspect11.aj new file mode 100644 index 000000000..19f742e85 --- /dev/null +++ b/tests/java5/covariance/CovAspect11.aj @@ -0,0 +1,10 @@ +aspect CovAspect11 { + + pointcut p1(): call(Car+ Sub.getCar()); + + before(): p1() { + System.out.println("[call(Car+ Sub.getCar()) matched on '"+thisJoinPoint+":"+thisJoinPoint.getSourceLocation()+"']"); + } + +} + diff --git a/tests/java5/covariance/CovBaseProgram01.jar b/tests/java5/covariance/CovBaseProgram01.jar new file mode 100644 index 000000000..5a89abea2 Binary files /dev/null and b/tests/java5/covariance/CovBaseProgram01.jar differ diff --git a/tests/java5/covariance/CovBaseProgram01.java b/tests/java5/covariance/CovBaseProgram01.java new file mode 100644 index 000000000..169a6be10 --- /dev/null +++ b/tests/java5/covariance/CovBaseProgram01.java @@ -0,0 +1,32 @@ +class Car {} + +class FastCar extends Car {} + +class Super { + Car getCar() { + return new Car(); + } +} + +class Sub extends Super { + FastCar getCar() { + return new FastCar(); + } +} + +public class CovBaseProgram01 { + public static void main(String[] argv) { + new CovBaseProgram01().run(); + } + + public void run() { + Super instance_super = new Super(); + Sub instance_sub = new Sub(); + + Car c1 = instance_super.getCar(); + Car c2 = instance_sub.getCar(); + } +} + +// FastCar is a subclass of Car. +// Sub is a subclass of Super. \ No newline at end of file diff --git a/tests/java5/covariance/CovBaseProgram02.jar b/tests/java5/covariance/CovBaseProgram02.jar new file mode 100644 index 000000000..93898a284 Binary files /dev/null and b/tests/java5/covariance/CovBaseProgram02.jar differ 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 diff --git a/tests/java5/covariance/build.xml b/tests/java5/covariance/build.xml new file mode 100644 index 000000000..121ec3b46 --- /dev/null +++ b/tests/java5/covariance/build.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3