JDK 8 code review request for 8005832: Remove java.lang.annotation.{ContainedBy, ContainerFor} annotation types
Alex Buckley
alex.buckley at oracle.com
Thu Jan 31 20:13:16 UTC 2013
On 1/31/2013 9:45 AM, Joe Darcy wrote:
> With Joel's recent push of 8005712, the repeating annotations feature
> has now transitioned from using the pair of annotation types
> {ContainedBy, ContainerFor} to the single Repeatable annotation.
>
> Please review the removal of the pair of old types:
>
> 8005832: Remove java.lang.annotation.{ContainedBy, ContainerFor}
> annotation types
> http://cr.openjdk.java.net/~darcy/8005832.0/
The type-level javadoc for InvalidContainerAnnotationError is:
"Thrown to indicate that an annotation type expected to act as a
container for another annotation type by virture of an @Repeatable
annotation, does not act as a container."
An _annotation type_ never acts as a container; an annotation acts as a
container. Also, it is preferable to avoid @Repeatable and instead defer
to the JLS 9.6 concept of "repeatable annotation type".
To be honest, I've never understood how InvalidContainerAnnotationError
differs from AnnotationFormatError. The spec has precisely one paragraph
calling for an AnnotationFormatError; if the implementation broke it
down into multiple cases, that should be added back to the spec and the
AFE subtype documented. (Please do that on
enhanced-metadata-spec-discuss, not a -dev list.)
Alex
More information about the core-libs-dev
mailing list