[seam-issues] [JBoss JIRA] Created: (SEAMFACES-208) Support for resolving no argument methods in an EL value expression

Dan Allen (JIRA) jira-events at lists.jboss.org
Wed Sep 21 19:23:27 EDT 2011


Support for resolving no argument methods in an EL value expression
-------------------------------------------------------------------

                 Key: SEAMFACES-208
                 URL: https://issues.jboss.org/browse/SEAMFACES-208
             Project: Seam Faces
          Issue Type: Feature Request
          Components: CDI Integration
    Affects Versions: 3.1.0.Beta2
            Reporter: Dan Allen
             Fix For: 3.1.0.Final


The EL specification added support for resolving parameterized methods in value and method expressions, with one exception. It does not support resolving methods with 0 parameters. The reason is that an () used at the end of a property is not acknowledged. As a result, the resolver attempts to resolve the method name as a bean property.

For example, assume we have the method:

{code}
public Integer count() {
    return 1;
}
{code}

If we attempt to resolve this in a value expression using:

{code}
#{bean.count()}
{code}

We can an error message "count property not found on bean"

It works as expected if the method has at least one parameter:

{code}
public Integer count(Integer i) {
    return i;
}
{code}

The following expression will resolve to a value of 1.

{code}
#{bean.count(1)}
{code}

This also breaks resolving the size of a collection:

{code}
#{employees.size()}
{code}

In this case, the error is a bit strange because it tries to parse size as an index.

The root cause of all this is that the spec does not properly honor 0 parameters as a valid number of parameters for a parameterized methods. Instead, it ignores the () and treats the expression as a property.

Method expressions does not have this limitation since both .action and .action() are equivalent expressions.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list