[JSR308] array-valued annotations
Matt McCutchen
hashproduct at csail.mit.edu
Mon Jan 29 17:09:16 EST 2007
On 1/29/07, Pavel Krupets <pavel.krupets at db.com> wrote:
> Yep. The main point is that array itself is an object (no matter whether
> it's n-dimensional or array of arrays with different lengths {which I
> think is a side effect :=)}) and it contains objects with the specified
> type. So we have two entities to which annotations can be applied.
I strongly disagree. According to the Introduction to the Java
Language Specification, Third Edition, "The language supports arrays
of arrays, rather than multidimensional arrays." I take you to mean
that it should be possible to annotate an array as a whole separately
from its element type. I believe that an array whose element type
happens to be another array should be no exception to this rule: it
should be possible to annotate all three levels separately.
Whether it is "appropriate" to use different annotations on different
levels is the programmer's judgment depending on the problem he/she is
trying to solve. But since Michael Ernst has given several examples
in which annotating different levels of an array separately is useful,
I think the specification should allow it.
Matt
More information about the JSR308
mailing list