AnnotationFormatError vs. IllegalArgumentException for invalid annotation interface members (methods)
Peter Levart
peter.levart at gmail.com
Sat Jan 7 08:40:17 UTC 2017
On 01/07/2017 09:26 AM, Peter Levart wrote:
> I'm thinking of moving the validateAnnotationMethods() method from
> AnnotationInvocationHandler where methods are being checked for each
> annotation instance constructed to AnnotationType, where they would be
> checked only once per annotation type and make exception reporting
> consistent for any invalid situation.
Correction: validateAnnotationMethods() is only invoked from the
annotation's equals() implementation when some JDK annotation is
compared with a foreign implementation of annotation (one that is not
using dynamic Proxy and AnnotationInvocationHandler). Which is a waste I
think and mostly to late or never. I think the methods should be checked
in AnnotationType constructor as soon as the 1st annotation of a
particular type is attempted to be materialized, don't you think?
Regards, Peter
More information about the core-libs-dev
mailing list