Re: Java generics unsoundness?
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
Dear Eijiro Sumii and all others,
not pretending to be the world authority on this issue, the following
does seem to apply:
- JLS mentions type erasure (4.6) so this would be part of the
language, but it is not an inherent property of type erasure that
these method name clashes arise.
- JLS does not mention bridge methods as far as I know, so
presumably it should be possible to implement them in a different way
without violating the language def. To avoid the method clash we
could use name mangling, i.e., including the types of the type-erased
arguments in the name of the method (as well as $ or similar, to
avoid clashes with user-defined names). Call sites would be compiled
in a context where the argument types are known, so they could easily
use the correct (mangled) name.
All in all, this seems to be a bug in the implementation.
Of course it is not that easy in practice, e.g., because
existing .class files would then break en masse...
On Sunday 01 October 2006 03:18, Eijiro Sumii wrote:
> [..]
>
> Dear all,
>
(Continue reading)