From d6bfe97b4db7f2109a4a088ebd0898b3ef8740e9 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 14 Jun 2005 13:58:09 +0000 Subject: [PATCH] Tests for 98320, 99228, 99089: [generics][itds] --- tests/bugs150/PR98320.aj | 18 +++++++++++++++ tests/bugs150/PR99228.aj | 22 +++++++++++++++++++ tests/bugs150/pr99089/DataClass.java | 14 ++++++++++-- tests/bugs150/pr99089/TracingAspect.java | 11 +++++++--- .../org/aspectj/systemtest/ajc150/ajc150.xml | 14 ++++++++++++ 5 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 tests/bugs150/PR98320.aj create mode 100644 tests/bugs150/PR99228.aj diff --git a/tests/bugs150/PR98320.aj b/tests/bugs150/PR98320.aj new file mode 100644 index 000000000..ad07cd9e3 --- /dev/null +++ b/tests/bugs150/PR98320.aj @@ -0,0 +1,18 @@ +import java.util.*; + +class C { + Set simple_local; + Set> nested_local; +} + +aspect Inter_Type_Injector { + Set C.simple_intertype; + Set> C.nested_intertype; + + public void test() { + Set simple_local = new C().simple_local; // works + Set simple_intertype = new C().simple_intertype; // works + Set> nested_local = new C().nested_local; // works + Set> nested_intertype = new C().nested_intertype; // fails + } +} diff --git a/tests/bugs150/PR99228.aj b/tests/bugs150/PR99228.aj new file mode 100644 index 000000000..78288c934 --- /dev/null +++ b/tests/bugs150/PR99228.aj @@ -0,0 +1,22 @@ +class Normal { int basicField;} +class Generic { int basicField;} + +aspect Injector { + void Normal.method() {} + void Generic.method() {} + int Normal.itdField; + int Generic.itdField; + + void test() { + new Normal().method(); + new Generic().method(); + + int n1 = new Normal().basicField; + int normal = new Normal().itdField; + + int a = new Generic().basicField; + int b = new Generic().itdField; + int c = new Generic().basicField; + int d = new Generic().itdField; + } +} diff --git a/tests/bugs150/pr99089/DataClass.java b/tests/bugs150/pr99089/DataClass.java index cbfb7905d..91e76763d 100644 --- a/tests/bugs150/pr99089/DataClass.java +++ b/tests/bugs150/pr99089/DataClass.java @@ -1,6 +1,16 @@ import java.util.Vector; public class DataClass { - private Vector v = new Vector(); - private Vector getV() { return v; } + private Vector v = new Vector(); + private Vector getV() { return v; } + + public static void main(String[]argv) { + DataClass dc = new DataClass(); + dc.v.add("hello"); + dc.doit(); + } + + public void doit() { + v.add("world"); + } } diff --git a/tests/bugs150/pr99089/TracingAspect.java b/tests/bugs150/pr99089/TracingAspect.java index ba3ef7ef6..f318797bf 100644 --- a/tests/bugs150/pr99089/TracingAspect.java +++ b/tests/bugs150/pr99089/TracingAspect.java @@ -1,7 +1,12 @@ import java.util.Vector; privileged aspect TracingAspect { - before(DataClass dc): execution(* DataClass.doit()) && this(dc) { - Vector myV = dc.getV(); - } + before(DataClass dc): execution(* DataClass.doit()) && this(dc) { + Vector myV = dc.getV(); + System.err.println("before:Length of v="+myV.size()); + } + after(DataClass dc): execution(* DataClass.doit()) && this(dc) { + Vector myV = dc.getV(); + System.err.println("after:Length of v="+myV.size()); + } } diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index eab14b2b3..00ab89eb9 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -72,6 +72,14 @@ + + + + + + + + @@ -114,6 +122,12 @@ + + + + + + -- 2.39.5