[JSR308] Section 3.5, syntax of array annotations

Bill Pugh pugh at cs.umd.edu
Fri Aug 3 12:26:45 EDT 2007


Yes, I understand that it may look backwards. The challenge is coming  
up with something that is a compatible extension of how type  
qualifiers will be used in pre-JSE7.

Bill

On Aug 3, 2007, at 4:47 AM, "Lex Spoon" <lex at lexspoon.org> wrote:

> Bill Pugh <pugh at cs.umd.edu> wrote:
>> Anyway, the annotation you are going want to use most frequently on a
>> multidimensional array is
>>
>> @Matrix double [][] data;
>>
>> which indicates that data is a rectangular unaliased and unchanging
>> matrix.
>>
>> If you want to do something for arrays, I'd encourage attemping
>> something simplier: just come up with a way to annotate the element
>> at the bottom of the array nesting. For example,
>>
>> @Nonnull int [] @Nonnegative data;
>>
>> to represent a nonnull reference to an array of nonnegative integers.
>
>
> Incidentally, the above notation looks backwards to my eye.  The
> annotation next to the variable (data) applies to the innermost type
> (int), while the annotation next to the innermost type applies to the
> variable.  Normally you would expect an annotation to apply to what it
> is sitting closest to.
>
> -Lex
>
> _______________________________________________
> JSR308 mailing list
> JSR308 at lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/jsr308



More information about the JSR308 mailing list