Description
Reported by Gerhard Petraceck
"...action methods are allowed to use void as return type the implementation forces a string, el-ri ignores the return type - juel e.g. checks for it and fails in case of void...."
The javadoc of ExpressionFactory.createMethodExpression says this:
"....If the expression is a String literal, a MethodExpression is created, which when invoked, returns the String literal, coerced to expectedReturnType. An ELException is thrown if expectedReturnType is void or if the coercion of the String literal to the expectedReturnType yields an error (see Section "1.16 Type Conversion")..."
"...expectedReturnType - The expected return type for the method to be found. After evaluating the expression, the MethodExpression must check that the return type of the actual method matches this type. Passing in a value of null indicates the caller does not care what the return type is, and the check is disabled...."
JSF 2.0 section 7.3 says this:
"... Application action is not a formal JSF API; instead any method that meets the following requirements may be used as an Action by virtue of evaluating a method binding expression:
■ The method must be public.
■ The method must take no parameters.
■ The method must return Object. ...."
The conclusion is null should be used as expectedReturnType for create action MethodExpressions, instead use String.class.
Attachments
Issue Links
- relates to
-
MYFACES-2968 ApplicationImpl.createMethodBinding should create expression with signature: void method(params)
- Closed