users@javaee-spec.java.net

[javaee-spec users] [jsr366-experts] Re: Updated Common Annotations spec

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Tue, 14 Jun 2016 09:14:52 -0700

Hi Antoine,

Thanks for the feedback.

Since I've already submitted the MR materials to the JCP, and the MR
is likely to go live either later today or shortly thereafter,
extension of the target of @Priority is something we should consider
for a subsequent release if there are concrete use cases that need to
be supported.

regards,

-Linda


On 6/14/16 2:09 AM, Antoine Sabot-Durand wrote:
> Hi Linda,
>
> The MR proposal is good for CDI expert group.
> I only had one remark from the EG (not related to CDI): why not allowing
> @Priority on other targets like methods? It could be useful for other
> use cases
>
> Antoine
>
> Le jeu. 26 mai 2016 à 22:49, Linda DeMichiel <linda.demichiel_at_oracle.com
> <mailto:linda.demichiel_at_oracle.com>> a écrit :
>
> After a final review of the Common Annotations spec draft and another
> sweep through the Interceptors spec, I noticed that there remained an
> inconsistency among specs as to whether PostConstruct/PreDestroy
> methods can be final.
>
> Here's the situation:
>
> For PostConstruct and PreDestroy methods, the Common Annotations spec
> states "The method MAY be final or non-final, except in the case of
> EJBs where it MUST be non-final."
>
> The Java EE 7 javadocs for PostConstruct and PreDestroy simply state:
> "The method may be final".
>
> The Interceptors spec states that all of the following interceptor
> method types MUST NOT be final:
> AroundInvoke
> AroundTimeout
> lifecycle callback methods (i.e. PostConstruct, PreDestroy,
> AroundConstruct)
>
> The Interceptors spec also forbids classes that declare interceptor
> bindings from containing final methods. This requirement was
> transferred from the CDI specification:
> "If a component class declares or inherits a class-level interceptor
> binding, it must not be declared final, or have any non-static,
> non-private, final methods."
>
> The CDI spec states that proxyable bean types must not have non-private
> final methods.
>
> The Servlet spec explicitly allows PreDestroy methods to be final.
> For PostConstruct, it doesn't state this explicitly, but rather just
> refers to the Common Annotations spec.
>
> To resolve this, I have replaced the relevant statements (as cited
> above) in the PostConstruct/PreDestroy sections of the
> CommonAnnotations spec with the following:
>
> "In general, the method method MUST NOT be final. However, other
> specifications are permitted to relax this requirement on a
> per-component basis."
>
> Similar language needs to be applied to the Interceptors spec for
> lifecycle callback methods. I plan to add this in the Interceptors MR
> that I am preparing.
>
> The Servlet 4.0 spec will need to add an explicit statement that
> PostConstruct methods may be final instead of just the reference to
> the Common Annotations spec.
>
> The javadocs for PostConstruct/PreDestroy have been modified to state
> "the method should not be final".
>
> I've posted updated documents to
> https://java.net/projects/javaee-spec/downloads
>
> -Linda
>