Repeating Annotations and backwards compatibility
alex.buckley at oracle.com
Thu Sep 13 12:00:16 PDT 2012
On Thursday, September 13, 2012 9:04:39 AM, Paul Benedict wrote:
> Was there any consideration given to NOT retrofitting annotations? That is,
> just allow repeating annotations; those with historical grouping
> annotations have to retain them to maintain the same reflection results.
> Then no "looking through" magic needs to occur at the reflection level. I
> think that's much more straight-forward than what's being proposed.
The goal was to be able to write repeating annotations without writing
the container annotation manually, and still have legacy consumers work
without modification when they a) expect a container annotation from
getAnnotation(Class<T>) and b) do not expect repeating annotations from
get[Declared]Annotations(). The Java EE group believes the number of
these legacy consumers to be significant.
New consumers which use the new get[Declared]Annotations(Class<T>)
methods can choose to ignore container annotations and grab the
possibly-repeated annotations directly.
More information about the enhanced-metadata-spec-discuss