AnnotatedExpr suggestion

Werner Dietl wdietl at gmail.com
Mon Jan 7 14:17:29 PST 2013


I like the JCDimension suggestion.
I see two options:
1. Always use JCDimension (a pair of annotations and size expression)
and JCNewArray would use a List<JCDimension>
2. Introduce a JCAnnotatedDimension, which is a JCExpression, and
JCNewArray continues to use a List<JCExpression>; the expressions are
either the size expression directly or an JCAnnotatedDimension
indirection.

Option 1 would be more consistent, but adds an additional node for the
common case of un-annotated array dimensions. If this memory overhead
is no concern, I think option 1 would be nicer.

cu, WMD.

On Fri, Jan 4, 2013 at 4:56 PM, Jonathan Gibbons
<jonathan.gibbons at oracle.com> wrote:
> Good point -- then the suggested name is wrong.
>
> Maybe a better suggestion would be JCDimension, which contains a
> List<JCAnnotation> (for the annotations of that dimension) and a
> JCExpression (for the "size" of that dimension).  Then JCNewArray would have
> a List<JCDimension>.
>
> -- Jon
>
>
> On 01/04/2013 04:37 PM, Werner Dietl wrote:
>>
>> On Thu, Jan 3, 2013 at 3:42 PM, Jonathan Gibbons
>> <jonathan.gibbons at oracle.com> wrote:
>>>
>>> Low priority suggestion:
>>>
>>> The following in JCNewArray is mildly icky.
>>>
>>>
>>>          public List<JCExpression> dims;
>>>          // type annotations on dimensions
>>>          public List<List<JCAnnotation>> dimAnnotations;
>>>
>>> Would it make sense to introduce JCAnnotatedExpression so that that
>>> reduces
>>> to
>>>        public List<JCAnnotatedExpression> dims;
>>
>> I would find JCAnnotatedExpression confusing. JSR 308 is only about
>> type annotations and annotations on expressions might at some point be
>> added.
>>
>> What kind of expressions are stored in dims? Is there a more specific
>> type we could use, e.g. are they all JCArrayTypeTree instances?
>>
>> cu, WMD.
>>
>



-- 
http://www.google.com/profiles/wdietl


More information about the type-annotations-dev mailing list