From: aclement Date: Tue, 26 Jul 2005 14:17:04 +0000 (+0000) Subject: sick sick sick generic itd tests. X-Git-Tag: V1_5_0M3~267 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9ecb2c94f5e3d9a882a34299f751ec7480973791;p=aspectj.git sick sick sick generic itd tests. --- 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 { public B getB(A a) { return null; } } + +aspect X { + public List 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 { + +} + +public class StaticFieldITDOnGenericType { + public static void main(String[] argv) { + MathUtils.n=42; + System.err.prinltn(">"+MathUtils.n); + } +} + +aspect X { + static E MathUtils.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 { + + public N doubleIt(N n) { + int i = Integer.parseInt(n); + return i*2; + } + +} + +public class StaticMethodITDOnGenericType { + public static void main(String[] argv) { + List ints = new ArrayList(); + ints.add(10); + System.err.println("Double(10)=" + MathUtils.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.first(List elements) { return elements.get(0); } +}