[cdi-dev] Clarify AnnotatedTypeConfigurator.remove(Annotation annotation)
Martin Kouba
mkouba at redhat.com
Mon Nov 28 07:10:03 EST 2016
For the record, I've submitted a proposal to replace remove(Class) and
remove(Annotation) methods with remove(Predicate) [1].
This not only simplifies the API but also provides an extensible way
of determining the annotations to remove (e.g. using
BeanManager.areQualifiersEquivalent()).
Martin
[1]
https://github.com/cdi-spec/cdi/pull/347
Dne 28.11.2016 v 10:39 Antoine Sabot-Durand napsal(a):
> Well, my guess is that the original intent was to provide an easy way to
> remove qualifiers or interceptor binding with members from class or
> method. It's powerful but probably too overkill.
>
> +1 for your proposal.
>
> Antoine
>
> On Fri, Nov 25, 2016 at 4:56 PM Martin Kouba <mkouba at redhat.com
> <mailto:mkouba at redhat.com>> wrote:
>
> Hi all,
>
> while working on https://issues.jboss.org/browse/CDI-646 I figured out
> that all "AnnotatedX.remove(Annotation annotation)" methods declare the
> following javadoc:
>
> "Remove annotations with (a) the same type and (b) the same annotation
> member value for each member which is not annotated {@link Nonbinding}.
> The container calls the {@link Object#equals(Object)} method of the
> annotation member value to compare values."
>
> I don't think this is correct. @Nonbinding is only used for interceptors
> bindings and qualifiers whereas the purpose of AnnotatedType SPI is more
> general.
>
> I believe those remove() methods should simply use
> java.lang.annotation.Annotation.equals(Object) to identify annotations
> to remove.
>
> What do you think?
>
> Thanks,
>
> Martin
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org <mailto:cdi-dev at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses
> the code under the Apache License, Version 2
> (http://www.apache.org/licenses/LICENSE-2.0.html). For all other
> ideas provided on this list, the provider waives all patent and
> other intellectual property rights inherent in such information.
>
--
Martin Kouba
Software Engineer
Red Hat, Czech Republic
More information about the cdi-dev
mailing list