[cdi-dev] [JBoss JIRA] (CDI-388) Session bean specialization example is not valid

Antoine Sabot-Durand (JIRA) issues at jboss.org
Wed Mar 12 10:49:10 EDT 2014


     [ https://issues.jboss.org/browse/CDI-388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on CDI-388 started by Antoine Sabot-Durand.

> Session bean specialization example is not valid
> ------------------------------------------------
>
>                 Key: CDI-388
>                 URL: https://issues.jboss.org/browse/CDI-388
>             Project: CDI Specification Issues
>          Issue Type: Bug
>            Reporter: Martin Kouba
>            Assignee: Antoine Sabot-Durand
>              Labels: CDI_spec_chge, Ready_to_fix
>             Fix For: 1.2 Proposed
>
>
> {code}
> @Stateless
> public class LoginActionBean implements LoginAction { ... }
> @Stateless @Mock @Specializes
> public class MockLoginActionBean extends LoginActionBean { ... }
> {code}
> {{LoginAction}} is a local interface (whether it's annotated with {{@Local}} or not) therefore the bean types of {{LoginActionBean}} are {{LoginAction}}, {{Object}}. On the other hand {{MockLoginActionBean}} does not have a local interface (client views exposed by a particular session bean are not inherited by a subclass; see also the EJB spec 4.9.2.1 Session Bean Superclasses). Therefore the bean types of {{MockLoginActionBean}} are {{MockLoginActionBean}}, {{LoginActionBean}} and {{Object}} (3.2.2 Bean types of a session bean: "the unrestricted set of bean types contains the bean class and all superclasses").
> The spec also states (4.3.1 Direct and indirect specialization):
> {quote}
> Furthermore, X must have all the bean types of Y. If X does not have some bean type of Y, the container automatically detects the problem and treats it as a definition error.
> {quote}
> So I believe the aforementioned example should result in a definition exception. To make it valid the {{MockLoginActionBean}} should also implement {{LoginAction}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list