diff options
author | aclement <aclement> | 2005-08-12 08:28:21 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-08-12 08:28:21 +0000 |
commit | eeee2b527b8c3fb871325c2e8805f57c6b5f1c40 (patch) | |
tree | 0147cd84b5676773bb8a4d20bfd0112ed52b4027 /tests | |
parent | a5da69fd4e851e2937b71a83ae20561bfce172ba (diff) | |
download | aspectj-eeee2b527b8c3fb871325c2e8805f57c6b5f1c40.tar.gz aspectj-eeee2b527b8c3fb871325c2e8805f57c6b5f1c40.zip |
genericitds: Using target type variables in your ITD field declarations.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldA.aj | 15 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldB.aj | 17 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldC.aj | 17 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldD.aj | 15 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldE.aj | 16 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldF.aj | 15 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldG.aj | 19 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldH.aj | 19 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldI.aj | 15 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldJ.aj | 21 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldK.aj | 22 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldL.aj | 19 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldM.aj | 24 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldN.aj | 12 | ||||
-rw-r--r-- | tests/java5/generics/itds/sharing/FieldO.aj | 12 |
15 files changed, 258 insertions, 0 deletions
diff --git a/tests/java5/generics/itds/sharing/FieldA.aj b/tests/java5/generics/itds/sharing/FieldA.aj new file mode 100644 index 000000000..b75bb459a --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldA.aj @@ -0,0 +1,15 @@ +import java.util.*; + +public class FieldA { + public static void main(String []argv) { + Base<Integer> base = new Base<Integer>(); + List<Integer> intList = new ArrayList<Integer>(); + base.j = intList; + } +} + +class Base<N extends Number> { } + +aspect X { + public List<Z> Base<Z>.j; // OK, Z becomes N +} diff --git a/tests/java5/generics/itds/sharing/FieldB.aj b/tests/java5/generics/itds/sharing/FieldB.aj new file mode 100644 index 000000000..c4b36aab6 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldB.aj @@ -0,0 +1,17 @@ +import java.util.*; + +public class FieldB { + public static void main(String []argv) { + Base<Integer,String> base = new Base<Integer,String>(); + List<Integer> intList = new ArrayList<Integer>(); + + } +} + +class Base<N extends Number,M> { + +} + +aspect X { + public List<Z> Base<Z>.j; // CE only supplied 1 type parameter +} diff --git a/tests/java5/generics/itds/sharing/FieldC.aj b/tests/java5/generics/itds/sharing/FieldC.aj new file mode 100644 index 000000000..63ab95946 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldC.aj @@ -0,0 +1,17 @@ +import java.util.*; + +public class FieldC { + public static void main(String []argv) { + Base<Integer> base = new Base<Integer>(); + List<List<Integer>> intList2 = new ArrayList<List<Integer>>(); + base.j=intList2; + + } +} + +class Base<N extends Number> { +} + +aspect X { + public List<List<Z>> Base<Z>.j; // ok - nested but OK +} diff --git a/tests/java5/generics/itds/sharing/FieldD.aj b/tests/java5/generics/itds/sharing/FieldD.aj new file mode 100644 index 000000000..8d00f1ee2 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldD.aj @@ -0,0 +1,15 @@ +import java.util.*; + +public class FieldD { + public static void main(String []argv) { + Base<Double,String> base = new Base<Double,String>(); + base.j= new HashMap<Double,String>(); + } +} + +class Base<N extends Number,S> { +} + +aspect X { + public Map<A,B> Base<A,B>.j; // ok multiple +} diff --git a/tests/java5/generics/itds/sharing/FieldE.aj b/tests/java5/generics/itds/sharing/FieldE.aj new file mode 100644 index 000000000..914c299bc --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldE.aj @@ -0,0 +1,16 @@ +import java.util.*; + +public class FieldE { + public static void main(String []argv) { + Base<Integer> base = new Base<Integer>(); + List<String> stringList = new ArrayList<String>(); + base.j = stringList; + } +} + +class Base<N extends Number> { +} + +aspect X { + public List<String> Base<Z>.j; // ok - specified type variable but didnt use it +} diff --git a/tests/java5/generics/itds/sharing/FieldF.aj b/tests/java5/generics/itds/sharing/FieldF.aj new file mode 100644 index 000000000..080a9c25e --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldF.aj @@ -0,0 +1,15 @@ +import java.util.*; + +public class FieldF { + public static void main(String []argv) { + Base<Double,String> base = new Base<Double,String>(); + base.j= new HashMap<String,Double>(); + } +} + +class Base<N extends Number,S> { +} + +aspect X { + public Map<A,B> Base<B,A>.j; // ok multiple reversed +} diff --git a/tests/java5/generics/itds/sharing/FieldG.aj b/tests/java5/generics/itds/sharing/FieldG.aj new file mode 100644 index 000000000..b950f3055 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldG.aj @@ -0,0 +1,19 @@ +import java.util.*; + +public aspect FieldG { + + // visibility options... + public List<Z> Base<Z>.i; // ok + private List<Z> Base<Z>.j; // ok + List<Z> Base<Z>.k; // ok + + public static void main(String []argv) { + Base<Integer> base = new Base<Integer>(); + List<Integer> intList = new ArrayList<Integer>(); + base.i = intList; + base.j = intList; + base.k = intList; + } +} + +class Base<N extends Number> { } diff --git a/tests/java5/generics/itds/sharing/FieldH.aj b/tests/java5/generics/itds/sharing/FieldH.aj new file mode 100644 index 000000000..40088e395 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldH.aj @@ -0,0 +1,19 @@ +import java.util.*; + +public class FieldH { + public static void main(String []argv) { + Base<Integer> baseInt = new Base<Integer>(); + Base<String> baseString = new Base<String>(); + + List<Integer> intList = new ArrayList<Integer>(); + List<String> strList = new ArrayList<String>(); + baseInt.j = intList; + baseString.j = strList; + } +} + +class Base<N> { } + +aspect X { + public List<Z> Base<Z>.j; // OK, Z becomes N in first case, S in the second ;) +} diff --git a/tests/java5/generics/itds/sharing/FieldI.aj b/tests/java5/generics/itds/sharing/FieldI.aj new file mode 100644 index 000000000..2412c8698 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldI.aj @@ -0,0 +1,15 @@ +import java.util.*; + +public class FieldI { + public static void main(String []argv) { + Base<Integer> base = new Base<Integer>(); + List<String> strList = new ArrayList<String>(); + base.j = strList; // error, violates bounds + } +} + +class Base<N extends Number> { } + +aspect X { + public List<Z> Base<Z>.j; // ok +} diff --git a/tests/java5/generics/itds/sharing/FieldJ.aj b/tests/java5/generics/itds/sharing/FieldJ.aj new file mode 100644 index 000000000..8633b678e --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldJ.aj @@ -0,0 +1,21 @@ +// This test covers something that arose whilst working on specifying +// ITDs on generic interfaces (which must be picked up by the top most +// implementing types). Here we check that a simple ITD on a generic +// interface works when the implementing class just references it in +// its raw form (see class 'One' below) +import java.util.*; + +public class FieldJ { + public static void main(String []argv) { + One o = new One(); + o.i = new ArrayList(); + } +} + +interface I<N extends Number> { } + +class One implements I {} + +aspect X { + public List I.i; +} diff --git a/tests/java5/generics/itds/sharing/FieldK.aj b/tests/java5/generics/itds/sharing/FieldK.aj new file mode 100644 index 000000000..ae50f9c16 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldK.aj @@ -0,0 +1,22 @@ +// This test covers something that arose whilst working on specifying +// ITDs on generic interfaces (which must be picked up by the top most +// implementing types). + +// Here we check that a simple ITD on a generic interface works when +// the implementing class is using it in some parameterized form. +import java.util.*; + +public class FieldK { + public static void main(String []argv) { + One o = new One(); + o.i = new ArrayList(); + } +} + +interface I<N extends Number> { } + +class One implements I<Double> {} + +aspect X { + public List I.i; +} diff --git a/tests/java5/generics/itds/sharing/FieldL.aj b/tests/java5/generics/itds/sharing/FieldL.aj new file mode 100644 index 000000000..e0378e262 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldL.aj @@ -0,0 +1,19 @@ +import java.util.*; + +public class FieldL { + public static void main(String []argv) { + List<Double> doubleList = new ArrayList<Double>(); + List<Float> floatList = new ArrayList<Float>(); + + One<Double> o = new One<Double>(); + o.i = new ArrayList(); + } +} + +interface I<N extends Number> { } + +class One<Z extends Number> implements I<Z> {} + +aspect X { + public List I.i; +} diff --git a/tests/java5/generics/itds/sharing/FieldM.aj b/tests/java5/generics/itds/sharing/FieldM.aj new file mode 100644 index 000000000..5b0b22656 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldM.aj @@ -0,0 +1,24 @@ +import java.util.*; + +public class FieldM { + public static void main(String []argv) { + List<Double> doubleList = new ArrayList<Double>(); + List<Float> floatList = new ArrayList<Float>(); + + One o = new One(); + o.i = new ArrayList(); + + Two t = new Two(); + t.i = floatList; + } +} + +interface I<N extends Number> { } + +class One implements I<Double> {} + +class Two implements I<Float> {} + +aspect X { + public List<Z> I<Z>.i; // ok +} diff --git a/tests/java5/generics/itds/sharing/FieldN.aj b/tests/java5/generics/itds/sharing/FieldN.aj new file mode 100644 index 000000000..e277d2ee1 --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldN.aj @@ -0,0 +1,12 @@ +import java.util.*; + +public class FieldN { + public static void main(String []argv) { + } +} + +interface I { } + +aspect X { + public List<Z> I<Z>.i; // error - the onType isn't generic! +} diff --git a/tests/java5/generics/itds/sharing/FieldO.aj b/tests/java5/generics/itds/sharing/FieldO.aj new file mode 100644 index 000000000..729f651fb --- /dev/null +++ b/tests/java5/generics/itds/sharing/FieldO.aj @@ -0,0 +1,12 @@ +import java.util.*; + +public class FieldO { + public static void main(String []argv) { + } +} + +interface I<N> { } + +aspect X { + public List<String> I<String>.i; // error, String is an exact type +} |