I wrote an el function with following signature which compares the double value:
java.lang.Number numberMinimum(java.lang.Number, java.lang.Number)
This works even using primitive data types,
but calling it using a value from a resource bundle results in:
java.lang.IllegalArgumentException: Cannot convert 99 of type class java.lang.String to class java.lang.Number
at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:412)
at com.sun.el.parser.AstFunction.getValue(AstFunction.java:123)
whereas changing the parameter to primitive int which the resource value is assigned to works?
int intMinimum(int, int)
Why is the expression-language autoconverting it to an int if desired target is of type int but not working for number?
El cannot convert to Number directly only to inheriting classes:
com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:412) checks if target type is of any type that implements Number but not Number itself.
There is no default implementation like using double if target type is of type Number.
http://grepcode.com/file/repo1.maven.org/maven2/org.mortbay.jetty/jsp-2.1/6.1.1rc1/com/sun/el/lang/ELArithmetic.java#ELArithmetic.isNumberType%28java.lang.Class%29