Possible showstopper: was Re: new tree node

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed May 8 14:28:40 PDT 2013


Werner,

The more I think about it, the more I think the correct solution is to 
merge JCVariableDecl and JCReceiverVariableDecl, by adding an extra 
field or method onto JCVariableDecl.

This is in line with the precedent to add a default value onto a method 
decl, for the similarly limited use case of the default value in 
annotation declarations.

I will work to create a changeset.

-- Jon


On 05/07/2013 07:01 PM, Jonathan Gibbons wrote:
> Werner,
>
> The problems with JCReceiverVariableDecl are more serious than I 
> thought. TreeCopier will definitely throw class cast exceptions at 
> runtime because of the unchecked cast in TreeCopier.copy.
>
> In general, it is not going to work to create this semi-private 
> subclass of JCVariableDecl and hope that everything works out. We 
> would need to either generalize JCVariableDecl, which implies changing 
> existing API, or else bite the bullet and add JCReceiverDecl, a 
> corresponding com.sun.source tree node, and update all related Kind, 
> Tag, Visitor, Scanner, Copier classes.
>
> -- Jon
>
>
> On 05/07/2013 04:45 PM, Jonathan Gibbons wrote:
>> Werner,
>>
>> If you add a new tree node in JCTree, you must add a corresponding 
>> new node in com.sun.source.tree. It is not enough to simply create 
>> JCReceiverVariableDecl be a subtype of JCVariableDecl :-(
>>
>> -- Jon
>>
>>
>



More information about the type-annotations-dev mailing list