[JSR308] Recap of annotations on arrays

Michael Ernst mernst at csail.mit.edu
Tue Jan 30 19:37:39 EST 2007

Let me recap the lively discussion regarding annotations on array types;
thanks to everyone who contributed.

Here are some facts that I think we can all agree upon:

1. The types at each level of a Java array are distinct; for instance,
   in Java the types int, int[], and int[][] are different.
   (Furthermore, Java does not have n-dimensional arrays, only arrays
   of arrays.)

2. It is technically sensible to have distinct annotations at
   different levels of an array.  For example, a 3x10 array of type
     int[ @Length(3) ][ @Length(10) ]
   has elements of type
     int[ @Length(10) ]
   which has elements of type
   (Note:  The syntax is still subject to change.)

3. Annotations on arrays are within the scope of JSR 308.
   (There was no confusion on this point among people who read the JSR
   308 webpage (http://pag.csail.mit.edu/jsr308/) and proposal; please
   inform yourself prior to raising an issue!)

4. The notion of annotations on arrays is confusing, at least to some
   people (maybe especially people who don't understand point 1 above?).

5. The syntax of annotations on arrays is confusing:  it's tough to
   decide exactly where the annotations on each level should appear.
   We have not yet resolved this issue.

6. We have not yet resolved whether the annotations on arrays are more
   confusing or more useful.  (It may require some experimentation to
   answer this question.)  If the former, we might decide to forbid
   annotations on array levels, even though they are technically
   sensible, and even though forbidding them would reduce the
   expressiveness of the annotation system.  Note that a compiler
   plug-in (that is, an annotation processor) is already permitted to
   forbid a particular annotation to appear in a given location.

You can see that we have made some progress, but some issues remain
to be resolved.


More information about the JSR308 mailing list