Generic Signatures

Andrew Haley aph@redhat.com
Sat Nov 4 11:06:00 GMT 2006


Jeroen Frijters writes:
 > 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).
OK, thanks. I'll try a new classpath import to gcj.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /