This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: Generic Signatures
- From: "Jeroen Frijters" <jeroen at sumatra dot nl>
- To: "Andrew Haley" <aph at redhat dot com>, <classpath at gnu dot org>, <java at gcc dot gnu dot org>
- Date: Sat, 4 Nov 2006 10:19:03 +0100
- Subject: RE: Generic Signatures
Andrew Haley wrote:
> I can't get even simple tests with generic signatures to work. Like
> this:
>
> public class test2
> {
> static class A extends ArrayList<String> {};
>
> public static void main(String[] args)
> {
> A a = new A();
> Object x = a;
> ((Collection)x).add(new Byte((byte) 1));
> System.out.println(x.getClass().getGenericSuperclass());
> System.out.println("We have a list parametrized with: " +
>
> ((ParameterizedType)x.getClass().getGenericSuperclass()).getAc
> tualTypeArguments()[0]);
> }
> }
This code works for me (on ikvm with classpath cvs head from a couple of
days ago).
Regards,
Jeroen