[JSR308] array-valued annotations

Eugene Kuleshov eu at javatx.org
Sun Jan 28 16:43:40 EST 2007

Joe Darcy wrote:
>> I agree that the type at the "leaves" must all be the same -- and they
>> must all have the same annotation.
>> However, Java does support different types at different levels of an
>> array.  For instance, consider an array of type Document[][].
>>  * The first level of the array has type Document[][].
>>  * The next level (i.the first level's elements) has type Document[].
>>  * The final level (the leaves) has type Document.
>> These are distinct types, though Java enforces that they have a
>> specific relationship to one another.
> At runtime these specific constraints are enforced via a store check 
> that relies on reified information about the array's type.  I believe 
> adding similar reification of annotation information would be 
> problematic and at compile time only accepting programs that didn't 
> need such runtime checks would be too incompatible.
  Joe, can you please elaborate why is that would be incompatible? 
Array-level annotation will be a new construct that won't be present in 
the old code.

  However new code and new annotation processors (not only the source 
level ones like in JSR 269) could use these new constructs.


More information about the JSR308 mailing list