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

From: Linda DeMichiel <>
Date: Thu, 26 May 2016 13:49:23 -0700

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:
   lifecycle callback methods (i.e. PostConstruct, PreDestroy,

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