[cdi-dev] [JBoss JIRA] (CDI-721) configureAnnotatedType vs setAnnotatedType restrition is unecessarily strict

Antoine Sabot-Durand (JIRA) issues at jboss.org
Tue Jan 30 04:28:00 EST 2018


    [ https://issues.jboss.org/browse/CDI-721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13525699#comment-13525699 ] 

Antoine Sabot-Durand commented on CDI-721:
------------------------------------------

Discussion on this topic took place nearly 18 months ago and decision was made to go that way.

Now that spec, TCK and API (including javadoc) are published, it is too late to ask for such a modification.

BTW at this step even a typo in the spec couldn't be officially released without a MR, so I don't understand how you can imagine that such a modification can be performed.

This said, I agree that giving the possibility to reuse an {{AnnotatedTypeConfigurator}} could be useful, but I disagree on mixing approach in a given {{ProcessAnnotatedType}} observer. Providing access to a reusable {{AnnotatedTypeConfigurator}} in future CDI version could make sense (if I remember we decided that it would be better to wait for user feedback to introduce such a feature).

So I suggest that instead of asking non backward compatibility change, we start thinking of pros and cons and eventually means to give access to a part of configurator API from outside container events.

> configureAnnotatedType vs setAnnotatedType restrition is unecessarily strict
> ----------------------------------------------------------------------------
>
>                 Key: CDI-721
>                 URL: https://issues.jboss.org/browse/CDI-721
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Portable Extensions
>    Affects Versions: 2.0 .Final
>            Reporter: Mark Struberg
>
> {noformat}
> Any observer of this event is permitted to wrap and/or replace the AnnotatedType by calling either setAnnotatedType() or configureAnnotatedType(). If both methods are called within an observer notification an IllegalStateException is thrown.
> {noformat}
> This rule is way too strict without any real reason.
> Any CDI container must support that both methods are being called on the same event payload anyway. Because we did not forbid that observerMethod1 invokes setAnnotatedType and observerMethod2 uses configureAnnoatedType. And that's good that way, otherwise the pluggability would be lost.
> We should delete this sentence without any substitution.
> The same applies to similar configurator methods like configureBeanAttributes, etc.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the cdi-dev mailing list