[ https://issues.apache.org/jira/browse/JEXL-429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17883891#comment-17883891 ]
Henri Biestro commented on JEXL-429: ------------------------------------ Something can be done to improve JEXL-412; a function call using a local variable can be used as hint. For the arithmetic new stricter behavior, the workaround would be to derive a JexlArithmetic and add a compare(String, Number) method; need to commit JEXL-428 related work first. PS: 2 issues in one ticket is really inconvenient. > Regressions in 3.4.0 > -------------------- > > Key: JEXL-429 > URL: https://issues.apache.org/jira/browse/JEXL-429 > Project: Commons JEXL > Issue Type: Bug > Affects Versions: 3.4.0 > Reporter: Shuo Geng > Priority: Major > > {*}Regression #1{*}: > {code:java} > "1.1" > 0 {code} > returns *true* in 3.3. But it throws an exception in 3.4.0. > {code:java} > java.lang.ArithmeticException: Object comparison:(1.1 GT 0) > at org.apache.commons.jexl3.JexlArithmetic.doCompare(JexlArithmetic.java:806) > at org.apache.commons.jexl3.JexlArithmetic.compare(JexlArithmetic.java:503) > at > org.apache.commons.jexl3.JexlArithmetic.greaterThan(JexlArithmetic.java:892) > at org.apache.commons.jexl3.internal.Interpreter.visit(Interpreter.java:1448) > at org.apache.commons.jexl3.parser.ASTGTNode.jjtAccept(ASTGTNode.java:19) > at org.apache.commons.jexl3.internal.Interpreter.visit(Interpreter.java:1532) > at > org.apache.commons.jexl3.parser.ASTJexlScript.jjtAccept(ASTJexlScript.java:137) > at > org.apache.commons.jexl3.internal.Interpreter.interpret(Interpreter.java:843) > at org.apache.commons.jexl3.internal.Script.execute(Script.java:239) {code} > {*}Regression #2{*}: > {code:java} > const f = function(a) {return a;}; > b ? b : f(2);{code} > When the script is executed, there is a variable *b* in the jexl context with > value as {*}1{*}. > The script returns 1 as expected in 3.3, but throws a parsing exception in > 3.4.0. > {code:java} > parsing error in ';' > at org.apache.commons.jexl3.JexlEngine.createScript(JexlEngine.java:411) > {code} > If the ternary statement is changed to {{b ? f(2) : b;}} , there is no issue > and 2 is returned as expected. -- This message was sent by Atlassian Jira (v8.20.10#820010)