[cdi-dev] [JBoss JIRA] (CDI-127) Add support for annotation scanning of Java enums

Jozef Hartinger (Reopened) (JIRA) jira-events at lists.jboss.org
Wed Dec 21 08:20:09 EST 2011


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

Jozef Hartinger reopened CDI-127:
---------------------------------



Reopening since several important aspects are not addressed in the specification.

h3. Validation
The specification does not require validation of enum injection points. The section 5.2.1 should be modified to include enums.

h3. ProcessAnnotatedType
{quote}The container must fire an event for each Java class or interface it discovers in a bean archive{quote} - enums should be added. Since enums can now receive injection, it may be interesting for extensions to examine/modify their annotated types.

h3. Bugs
{quote}The container is also required to perform dependency injection whenever it instantiates any of the following non-
contextual objects: enums
{quote}
{quote}When the container creates a new instance of a managed bean, session bean, enum, or of any other Java EE component
class supporting injection, the container must:{quote}
Expressions "Instantiating enum" or "creating a new instance of enum" are not technically correct, because the container never creates a new instance.

----

Furthemore, I suggest the following changes to be considered by the expert group:

h3. New beans:
{quote} The container discovers @New qualified beans by inspecting injection points of other enabled beans.{quote}
I suggest aligning the discovery process of @New qualified beans to cover Java enums.

h3. ProcessInjectionTarget
Internally, Weld uses an implementation of the InjectionTarget interface for injecting and disposing enum instances. It may be useful to require enum injection to be treated this way and allow extensions to alter the injection mechanism by overriding the InjectionTarget implementation. This can be achieved by requiring that the container fires a ProcessInjectionTarget event for each enum type it may inject.


                
> Add support for annotation scanning of Java enums
> -------------------------------------------------
>
>                 Key: CDI-127
>                 URL: https://issues.jboss.org/browse/CDI-127
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Beans
>            Reporter: Brian Leathem
>            Assignee: Pete Muir
>             Fix For: 1.1.EDR1
>
>
> It would be useful if Java enums were included in the CDI annotation scan.
> A use case for this is found in the Seam Faces project, where we would like to use annotations on enums for configuration purposes.  The annotation would look like:
> @ViewConfig
> public enum Pages {
>     ...
> }
> It is my understanding that the current CDI specification (1.0) does not require scanning of the enum and will not pick up the @ViewConfig annotation.

--
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