From 735d94f91a02e08bf5a1a86185b9318de4bd4319 Mon Sep 17 00:00:00 2001 From: acolyer Date: Mon, 21 Nov 2005 22:05:46 +0000 Subject: tests and fix for pr114332 - reflection api not detecting abstract itdms. --- tests/java5/reflection/Billing.aj | 29 +++++++++++++++++++++++++++++ tests/java5/reflection/ReflectBilling.java | 18 ++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/java5/reflection/Billing.aj create mode 100644 tests/java5/reflection/ReflectBilling.java (limited to 'tests/java5') diff --git a/tests/java5/reflection/Billing.aj b/tests/java5/reflection/Billing.aj new file mode 100644 index 000000000..0c9923ea4 --- /dev/null +++ b/tests/java5/reflection/Billing.aj @@ -0,0 +1,29 @@ +public aspect Billing { + + public Customer Connection.payer; + + /** + * Connections give the appropriate call rate + */ + public abstract long Connection.callRate(); + + public long LongDistance.callRate() { return 1; } + public long Local.callRate() { return 2; } + + /** + * Customers have a bill paying aspect with state + */ + public long Customer.totalCharge = 0; + + public void Customer.addCharge(long charge){ + totalCharge += charge; + } +} + +class Customer {} + +abstract class Connection {} + +class LongDistance extends Connection {} + +class Local extends Connection {} diff --git a/tests/java5/reflection/ReflectBilling.java b/tests/java5/reflection/ReflectBilling.java new file mode 100644 index 000000000..c93292cb1 --- /dev/null +++ b/tests/java5/reflection/ReflectBilling.java @@ -0,0 +1,18 @@ +import org.aspectj.lang.reflect.*; + +public class ReflectBilling { + + public static void main(String[] args) { + AjType billingType = AjTypeSystem.getAjType(Billing.class); + InterTypeMethodDeclaration[] itdms = billingType.getDeclaredITDMethods(); + for(InterTypeMethodDeclaration itdm : itdms) { + System.out.println(itdm); + } + InterTypeFieldDeclaration[] itdfs = billingType.getDeclaredITDFields(); + for(InterTypeFieldDeclaration itdf : itdfs) { + System.out.println(itdf); + } + } + + +} \ No newline at end of file -- cgit v1.2.3