This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Parameterizing on incomplete types
On Dec 1, 2011, at 1:35 PM, Per Bothner wrote:
On 12/01/2011 01:05 AM, Per Bothner wrote:
string>:1:27: type parameter T must extend Object which is
incompatible
with Foo
This is because we haven't set yet Foo's supertypes. Of course this
is
nonsense in the special case of Object. I think we can fix the
general
case by moving the subtype test later, probably to InlineCalls.
The tricky part is figuring out how to do the subtype test in
InlineCalls.
Commenting out that test leads to:
<string>:1:1: missing implementation for
java.lang.Comparable.compareTo(T)int
Commenting out *that* test (in ClassExp) lets the compilation finish,
and I get a class file (if I compile a file with -C).
However, the compiler doesn't generate any bridge methods, so I can't
imagine the code actually running.
Well, it's a start. Thanks for looking into it. "Comment stuff out
until it
builds" is one of my favorite debugging techniques. :-)
It probably makes sense to generate the bridge methods at the same
time as we check for missing implementations.
Where are they generated now? Is that what the recursive call to
ClassExp#getImplMethods() is doing?
Does it matter that Access.BRIDGE and Access.SYNTHETIC don't seem to be
used anywhere?
(Though note that generating the "missing implementation" error
during code generation is a semi-bug in itself: The goal is that all
errors and warning should be generated in one of the earlier phases,
typically InlineCalls or earlier. One reason is that hypothetical
IDE-based
on-the-fly error checking, as in NetBeans, would be faster and
simpler if
it didn't have to do code generation.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/
--
Jamison Hope
The PTR Group
www.theptrgroup.com