[type-annos-observers] ordering of annotated array brackets

Alex Buckley alex.buckley at oracle.com
Wed Mar 5 11:37:02 PST 2014


On 3/4/2014 4:31 PM, Michael Ernst wrote:
> My position is that this assignment should type-check for any type MyType:
>
>   MyType arr1, arr2[];
>   arr2[7] = arr1;
>
> I think it would be extremely confusing to users (it would violate the
> principle of least surprise) if this was not the case.  In particular,
> this assignment should type-check:
>
>   @A T @B [] arr1, arr2 @C [];
>   arr2[7] = arr1;

I understand this logic, and I accept that post-identifier bracket pairs 
were described long ago in java-annotation-design.pdf. But I just can't 
agree with convoluting the basic type-of-a-variable rules to handle 
annotations in mixed array syntax. Please see my response to Markus:

http://mail.openjdk.java.net/pipermail/type-annotations-spec-observers/2014-March/000278.html

Alex



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