Bug 9861 and Java 5 Generics
Per Bothner
per@bothner.com
Wed Aug 17 18:57:00 GMT 2005
Andrew Haley wrote:
> It's for generics. To be truthful it's for compatibility with the
> Java VM spec, which has always distinguished methods that differ only
> in the type of the return value.
Hm. If someone "manually" generates a .class containing two methods
'int foo()' and 'double foo()' and also contains calls to those methods,
is that something we should support? I'd have to look carefully in
the vm spec to see what it says, and also see what jdk does. But
even if it turns out to a technically valid classfile, it's clearly
not important to support it.
On the other hand being compatible with the C++ ABI is also desirable,
but not very important in itself.
> If there's some way to be compatible with C++ I'm all for it,
> especially if it allows us to avoid gdb changes. My understanding is
> that C++ covariant returns are much more restricted,
I don't believe so. C++ does have a complication in that you may need
to adjust the returned pointer in the case of multiple inheritance.
That might require a stub method. I don't know if g++ implements this.
Anyway adjusting the pointer isn't a factor for Java methods.
http://www.codesourcery.com/cxx-abi/abi.html
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Java
mailing list