[cdi-dev] [JBoss JIRA] (CDI-244) Allow public static fields on managed beans which declare any other scope than dependent

Pete Muir (JIRA) jira-events at lists.jboss.org
Tue Aug 21 17:51:15 EDT 2012


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

Pete Muir updated CDI-244:
--------------------------

    Fix Version/s:     (was: 1.1 (Proposed))

    
> Allow public static fields on managed beans which declare any other scope than dependent
> ----------------------------------------------------------------------------------------
>
>                 Key: CDI-244
>                 URL: https://issues.jboss.org/browse/CDI-244
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>            Reporter: Martin Kouba
>            Assignee: Pete Muir
>             Fix For: 1.1.EDR2
>
>
> See 3.1. Managed beans:
> {quote}
> If a managed bean has a public field, it must have scope @Dependent. If a managed bean with a public field declares any scope other than @Dependent, the container automatically detects the problem and treats it as a definition error.
> {quote}
> I see no reason why to disallow public _static_ fields on normal scoped beans. To treat public _non-static_ fields as a definition error due to proxy generation is reasonable. However public static fields are usually referenced by the class name and refering to static fields with an object reference (proxy in this case) is discouraged. Moreover, protected and package-private fields which might also cause confusion around proxies are allowed.
> BTW Weld allows public static fields on normal scoped beans at the moment.
> Maybe the spec wording could be:
> {quote}
> 3.1. Managed beans
> If a managed bean has a _non-static_ public field, it must have scope @Dependent. If a managed bean with a _non-static_ public field declares any scope other than @Dependent, the container automatically detects the problem and treats it as a definition error.
> {quote}

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