[JSR308] array-valued annotations

Doug Lea dl at cs.oswego.edu
Sun Jan 28 19:35:06 EST 2007


[First: Hi everyone!]

[Second: Apologies in advance that I probably won't have a lot of
time to devote to JSR308 stuff in the near future.]

[OK, Back to arrays...]

Arrays have been problems in all sorts of ways in all sorts of
JSRs over the years. My sense is that you must expect up
front to compromise goals and at best come up with something
that doesn't introduce too many new oddities, to add to the existing
oddities that
(1) arrays don't work right with generics;
(2) things like "int[]" are sorta classes,  but not  first-class classes;
(3) you cannot qualify elements as final or volatile;
(4) Nobody, especially the people who use them most,
thinks that multidimensional arrays are
a reasonable substitute for having proper uniform matrices.
Etc.

One unforseen byproduct of generics in Java 5 is that people
seems to use collections like ArrayLists in a lot of cases
where they would have previously used arrays. So perhaps
there is less pressure to get arrays right, so long as we can get
collections "right".

I think that Tom's initial reaction to suggestions about notation
probably reflects this. While you can do some strange things
with arrays, most of the strangenesses are not the kinds of things
that you'd show your mom, not to mention spend time annotating.

So, given all this, it might be useful to center discussion
on use cases: What kinds of common, useful, non-embarassing
constructions do we think that people will want to annotate, and
how? Maybe getting 90% of this covered is the best to hope for?


-Doug



More information about the JSR308 mailing list