This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Parameterizing on incomplete types
On 12/02/2011 10:33 PM, Jamison Hope wrote:
On Dec 2, 2011, at 2:48 AM, Per Bothner wrote:
I checked in a patch that effectively special-cases Object.
(Specifically, I added an "optimization" is ClassType#isSubclass.)
So we no longer get that error - now we just have to deal with
<string>:1:1: missing implementation for
java.lang.Comparable.compareTo(T)int
That patch works for parameterizations like <T> (which is really <T
extends Object>),
but not the general case where the type could have some other restriction
(e.g. <T extends java.util.List>).
Right. But handling the general case looks non-trivial.
How ambitious are you about getting into Deep Kawa Stuff? :-)
Sounds awesome, let's do it.. um, how?
There are 2 parts, I think - (1) moving the type comparison from
BracketApply to
a later compilation stage, and (2) determining and injecting appropriate
bridge
methods. I have a vague notion of how someone might do #1. Not so much
for #2..
(1) isn't fundamentally difficult, but it's tricky figuring out where
and how to do it. It should probably be done as part of the InlineCalls
tree-walker. And (1) isn't very useful until we solve (2), which
is why I suggest deferring it.
(2) mostly just a matter of code: generating the needed
bridge methods. How the <init> methods are generated is probably
a helpful illustration. The other (more interesting?) part is
figuring out *when* we need a bridge method, and the necessary
signature.
--
--Per Bothner
per@bothner.com http://per.bothner.com/