[
https://issues.jboss.org/browse/CDI-527?page=com.atlassian.jira.plugin.sy...
]
Mark Struberg edited comment on CDI-527 at 5/21/15 12:31 PM:
-------------------------------------------------------------
No, rather the opposite. EJB allows it. But most probably purely as side effect. Up to and
including EJB-3.1 all non 'Business Methods' can be final. That includes package
and protected methods for @Local and NIVs or even public methods if you have an EJB API!
EJB really did only care about the proxying of their 'Business Methods'. From this
pov CDI is really the same, BUT there is one huge difference: In CDI we treat much more
methods as 'Business Methods'. E.g. it is perfectly fine to do a @Inject SelfClass
self and invoke a protected or package scoped method on it. So for CDI all non-private,
non-static methods are 'Business Methods' and can get intercepted, decorated, and
proxied.
Only in EJB-3.2 the NIV case was 'fixed'. Or rather got broken in hindsight of
backward compat... I already had a talk with one from the EJB EG who agreed that this was
most likely an unintentional backward incompatible change. It also makes zero sense for
NIV EJBs as they _explicitely_ declare that still only public methods are 'Business
Methods'.
F
was (Author: struberg):
No, rather the oposite. EJB allows it. But most probably purely as side effect. Up to and
including EJB-3.1 all non 'Business Methods' can be final. That includes package
and protected methods for @Local and NIVs or even public methods if you have an EJB API!
EJB really did only care about the proxying of their 'Business Methods'. From this
pov CDI is really the same, BUT there is one huge difference: In CDI we treat much more
methods as 'Business Methods'. E.g. it is perfectly fine to do a @Inject SelfClass
self and invoke a protected or package scoped method on it. So for CDI all non-private,
non-static methods are 'Business Methods' and can get intercepted, decorated, and
proxied.
Only in EJB-3.2 the NIV case was 'fixed'. Or rather got broken in hindsight of
backward compat... I already had a talk with one from the EJB EG who agreed that this was
most likely an unintentional backward incompatible change. It also makes zero sense for
NIV EJBs as they _explicitely_ declare that still only public methods are 'Business
Methods'.
F
allow proxying of classes with non-private final methods
--------------------------------------------------------
Key: CDI-527
URL:
https://issues.jboss.org/browse/CDI-527
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Beans
Affects Versions: 1.2.Final
Reporter: Mark Struberg
Fix For: 2.0 (discussion)
Currently we explicitly disallow proxying of classes with non-private final methods.
EJB _does_ allow this. And there are a few final methods in the JDK and other libs. E.g.
HashMap#initHashSeedAsNeeded. Currently we cannot have a producer method for it.
We might rethink our decision and allow it. Probably with an own annotation like
@AllowProxying which disables this check for certain cases (subclass managed-beans or
producers).
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)