Bug 9861 and Java 5 Generics

Tom Tromey tromey@redhat.com
Wed Aug 17 19:15:00 GMT 2005


Per> Could you point to summary of why we need return types?  Is it for
Per> generics, or for co-variant return types, or both?

Per> If it is for co-variant return types, then C++ supports those, so
Per> why can't we use the ABI it uses?  A complication is that we have
Per> to handle .class files that contains javac-generated stub methods
Per> that implement the JDK mechanism for co-variant return types,
Per> but it should be possible to suppress generating code for those
Per> methods.  (A further complication is that this has to be done
Per> for both the compiler and the interpreter, at least to the
Per> extent that we produce compatible vtable and interface tables.)

One question is how we will tell the difference between a bridge
method introduced for generics and one introduce for covariant
returns.  I think the former are needed for type safety.

The latter may even be needed for type safety.  I am not certain.
Eclipse's compiler emits a funny 'checkcast' in the bridge method it
generates for a simple covariant return.  (This could be an Eclipse
bug, I haven't thought it through.)

Tom



More information about the Java mailing list