JLS Creator production does not use 'Type'

Alex Buckley alex.buckley at oracle.com
Thu Apr 18 12:10:30 PDT 2013


Mike, please respond to the mail below. The Creator production is not 
the 308 spec from 4/1 and so annotations are not allowed after a 'new' 
keyword, period. Accordingly, the current discussion on 
jsr308-discuss at googlegroups.com is _wrong_ to assume the following is legal:

Object o = new @A String[1];
Object o = new String @A[1];

Alex

On 4/1/2013 12:32 PM, Alex Buckley wrote:
> On 3/31/2013 11:33 AM, Michael Ernst wrote:
>>> The JSR 308 spec has a problem: the 'Creator' production in JLS ch.18
>>> does
>>> not use 'Type', so it is unaffected by JSR 308's addition of
>>> 'Annotations'
>>> to 'Type'. In other words, no annotations after 'new' are permitted
>>> by the
>>> spec! Obviously they should be, if their type has TYPE or TYPE_USE in
>>> @Target.
>
> When and where was the message sent which calls out Creator as not using
> Type? I recall identifying that AnnotationTypeElementRest et al must use
> UnannType rather than Type - but I cannot find mails about Creator, so I
> am worried a production might be overlooked.
>
>> I'm sorry, but I can't remember what decision we made about fixing this
>> problem with the JLS specification.  Are you going to change that in the
>> JLS, so that the JSR 308 specification doesn't have to call it out?
>> Or, do
>> you want the JSR 308 specification to change the BNF rules for Creator,
>> ArrayCreator, and InnerCreator?
>
> The latter, please - 308 should add [Annotations] to Creator et al. The
> former - adopting Type in Creator et al - would be tricky because of
> diamond and partially-dimensioned array types.
>
> Alex


More information about the type-annotations-spec-experts mailing list