Proposal: Access to Generic Type Parameters at Compile-Time

Mark Mahieu markmahieu at googlemail.com
Wed Mar 18 00:51:01 PDT 2009


I think it's worth mentioning.
Incidentally, this idea touches on the same kind of issue regarding names:
http://blogs.sun.com/abuckley/en_US/entry/named_parameters

Mark


2009/3/18 David Walend <david at walend.net>

> Hi Mark,
>
>
> On Mar 17, 2009, at 12:22 PM, Mark Mahieu wrote:
>
>> Hi David,
>>
>> On 17 Mar 2009, at 02:37, David Walend wrote:
>>
>>>
>>> interface Path<ThruGraph extends Digraph>
>>>    extends Digraph<ThruGraph.Node,ThruGraph.Edge>
>>>    {
>>>        ThruGraph.Node getHead();
>>>        ...
>>>    }
>>>
>>
>> So, if I were the author of Digraph and I decided to rename its type
>> parameters (to N and E for example), your Path interface would no longer
>> compile?
>>
>
> That's correct. Changing the name of a type parameter would have the
> same potential impact as renaming other public/protected/default-accessible
> parts of the class, like an inner class, a static method or a static member
> field.
>
> Changing an extends or super clause risks breaking something. Adding or
> removing type parameters almost always breaks downstream code that uses the
> class. The name of the type parameter is (I think) the only thing you can
> safely change in the parameter list currently.
>
> I think this problem would come up far less often than breaking the
> interface by adding an extends or super clause to an existing
> parameter. Is it a big enough problem to add to the disadvantages list?
>
> Thanks,
>
>
> Dave
>
> David Walend
> david at walend.net
>
>



More information about the coin-dev mailing list