diff options
author | aclement <aclement> | 2005-07-26 14:17:04 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-07-26 14:17:04 +0000 |
commit | 9ecb2c94f5e3d9a882a34299f751ec7480973791 (patch) | |
tree | 27df336a51b50cddd3869c28994fd5bec6795920 /tests | |
parent | a3dd516b80debb7dfd0c45fa2b0e8ad7959b4b91 (diff) | |
download | aspectj-9ecb2c94f5e3d9a882a34299f751ec7480973791.tar.gz aspectj-9ecb2c94f5e3d9a882a34299f751ec7480973791.zip |
sick sick sick generic itd tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/java5/generics/itds/MethodITDOnGeneric.aj | 5 | ||||
-rw-r--r-- | tests/java5/generics/itds/StaticFieldITDOnGeneric.aj | 20 | ||||
-rw-r--r-- | tests/java5/generics/itds/StaticMethodITDOnGenericType.aj | 29 |
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/java5/generics/itds/MethodITDOnGeneric.aj b/tests/java5/generics/itds/MethodITDOnGeneric.aj new file mode 100644 index 000000000..ce024337d --- /dev/null +++ b/tests/java5/generics/itds/MethodITDOnGeneric.aj @@ -0,0 +1,5 @@ +class C<A,B> { public B getB(A a) { return null; } } + +aspect X { + public List<C> C<D,C>.getBs(D ds) { return null; } +} diff --git a/tests/java5/generics/itds/StaticFieldITDOnGeneric.aj b/tests/java5/generics/itds/StaticFieldITDOnGeneric.aj new file mode 100644 index 000000000..44194fae1 --- /dev/null +++ b/tests/java5/generics/itds/StaticFieldITDOnGeneric.aj @@ -0,0 +1,20 @@ +/* + * Static ITD of a field onto a generic type that utilises + * a type variable from the target generic + */ +import java.util.*; + +class MathUtils<N> { + +} + +public class StaticFieldITDOnGenericType { + public static void main(String[] argv) { + MathUtils<Integer>.n=42; + System.err.prinltn(">"+MathUtils<Integer>.n); + } +} + +aspect X { + static E MathUtils<E>.n; +} diff --git a/tests/java5/generics/itds/StaticMethodITDOnGenericType.aj b/tests/java5/generics/itds/StaticMethodITDOnGenericType.aj new file mode 100644 index 000000000..91b51a61d --- /dev/null +++ b/tests/java5/generics/itds/StaticMethodITDOnGenericType.aj @@ -0,0 +1,29 @@ +/* + * Static ITD of a method onto a generic type that utilises + * a type variable from the target generic + */ +import java.util.*; + +class MathUtils<N> { + + public N doubleIt(N n) { + int i = Integer.parseInt(n); + return i*2; + } + +} + +public class StaticMethodITDOnGenericType { + public static void main(String[] argv) { + List<Integer> ints = new ArrayList<Integer>(); + ints.add(10); + System.err.println("Double(10)=" + MathUtils<Integer>.doubleIt(5)); + System.err.println("First=" + MathUtils.first(ints)); + } +} + + +aspect X { + // Using the type variable from the type. this is not a generic method. + static E MathUtils<E>.first(List<E> elements) { return elements.get(0); } +} |