[cdi-dev] [JBoss JIRA] (CDI-221) Throw definition error if the set of decorated types of a decorator is empty

Pete Muir (JIRA) jira-events at lists.jboss.org
Fri Aug 17 07:08:14 EDT 2012

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

Pete Muir updated CDI-221:

    Issue Type: Bug  (was: Feature Request)

I'm pretty sure this is just a bug in the spec, as a decorator that has no decorated types makes no sense.

Note that somewhere there is a feature request to support decorators on classes (without interfaces). I'll try to find it :-)
> Throw definition error if the set of decorated types of a decorator is empty
> ----------------------------------------------------------------------------
>                 Key: CDI-221
>                 URL: https://issues.jboss.org/browse/CDI-221
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Decorators
>            Reporter: Marko Lukša
>             Fix For: 1.1 (Proposed)
> I propose the following addition to section 8.1:
> "If the set of decorated types of a decorator is empty, the container automatically detects the problem and treats it as a definition error."
> This would be helpful in cases where the developer is not aware that a decorator and decorated bean must share the same interface, and thinks that a decorator can be defined simply by extending the decorated class (as in the following example).
> {code}
> public class MyBean {
>     public Object foo() {...}
> }
> @Decorator
> public class MyDecorator extends MyBean {
>     @Inject @Delegate MyBean delegate;
>     public Object foo() {...}
> }
> {code}
> Even though the spec does explicitly state that "superclasses are not decorated types of the decorator", throwing an error would probably save some people's debugging time.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list