[weld-issues] [JBoss JIRA] (WELD-1106) Default name for a managed bean is not correct for class name that starts with two or more upper case letters

Marko Lukša (JIRA) jira-events at lists.jboss.org
Mon Apr 16 07:14:19 EDT 2012


    [ https://issues.jboss.org/browse/WELD-1106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12684432#comment-12684432 ] 

Marko Lukša commented on WELD-1106:
-----------------------------------

I'm not sure this is really a bug.

Consider the following producer method:
{code}
@Produces @Named
public GMOCod getGMOCod() {
    ...
}
{code}

You'd probably expect GMOCod to be available under the name "gMOCod" (analogous to "gMOCarp"). However, the CDI spec says this:
{quote}
3.3.8. Default name for a producer method

The default name for a producer method is the method name, unless the method follows the JavaBeans property getter naming convention, in which case *the default name is the JavaBeans property name*.
{quote}

And the JavaBeans spec says this:
{quote}
8.8 Capitalization of inferred names.

...

Thus when we extract a property or event name from the middle of an existing Java name, we normally convert the first character to lower case. However to support the occasional use of all upper-case names, *we check if the first two characters of the name are both upper case and if so leave it alone*.
{quote}


So, according to the specs, the bean declared by the producer method should be named "GMOCod" (and not "gMOCod"). This brings into question if the managed bean should really be named "gMOCarp". Probably not. 

I guess this should be clarified in the 1.1 spec.

                
> Default name for a managed bean is not correct for class name that starts with two or more upper case letters
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: WELD-1106
>                 URL: https://issues.jboss.org/browse/WELD-1106
>             Project: Weld
>          Issue Type: Bug
>          Components: Class Beans (Managed and Session)
>    Affects Versions: 1.1.5.Final
>            Reporter: Viacheslav Kabanovich
>            Assignee: Marko Lukša
>         Attachments: weld-tests-named.jar
>
>
> "3.1.5. Default name for a managed bean
> The default name for a managed bean is the unqualified class name of the bean class, after converting the first character to
> lower case."
> For a class named XBean, default name of a managed bean should be xBean. However, in runtime with Weld 1.1.5, this name is not available in EL, instead name XBean is available.

--
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 weld-issues mailing list