You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The javadoc of AnnotationLiteral should discourage instantiation using anonymous classes.
Definition of Annotation#equals, among other thing, says that:
returns true if the specified object is an instance of the same annotation interface as this instance
However, this can never be honored by anonymous class for AnnotationLiteral as it simply doesn't implement given annotation.
Standard class extending AnnotationLiteral can and does that just fine.
We could change the javadoc from saying just:
An instance of an annotation type may be obtained by subclassing AnnotationLiteral.
To something like:
An instance of an annotation type may be obtained by subclassing AnnotationLiteral.
The subclass must implement the annotation interface to satisfy the {@link Annotation} contract.
Side note: There are TCK tests that use anonymous AnnotationLiteral that we should look into as well. The change will be trivial.
The text was updated successfully, but these errors were encountered:
The javadoc of
AnnotationLiteral
should discourage instantiation using anonymous classes.Definition of
Annotation#equals
, among other thing, says that:However, this can never be honored by anonymous class for
AnnotationLiteral
as it simply doesn't implement given annotation.Standard class extending
AnnotationLiteral
can and does that just fine.We could change the javadoc from saying just:
To something like:
Side note: There are TCK tests that use anonymous
AnnotationLiteral
that we should look into as well. The change will be trivial.The text was updated successfully, but these errors were encountered: