William Price created JEXL-437:
----------------------------------
Summary: Semicolons not actually optional between function calls
on separate lines
Key: JEXL-437
URL: https://issues.apache.org/jira/browse/JEXL-437
Project: Commons JEXL
Issue Type: Bug
Affects Versions: 3.4.0, 3.3
Environment: JEXL 3.4.0 (also tested on 3.3)
OpenJDK 23.0.2 (Red Hat, Inc. 23.0.2+7)
Linux 5.15.167.4-microsoft-standard-WSL2 amd64
Reporter: William Price
The syntax documentation states that "Statements are optionally terminated with
a semicolon" but I'm finding that semicolons are *required* when invoking a
script-defined function multiple times, with each invocation on a separate line.
{code:java}
let values = [...]
function append(const value) {
values.add(value)
}
append(1)
append(2)
return values {code}
h3. Expected result:
{code:java}
[1, 2, ...] // list size 2 containing integers 1 and 2{code}
h3. Actual Result:
{code:java}
org.apache.commons.jexl3.JexlException$Ambiguous: @7:1 ambiguous statement
error in 'append(2)'
at
app//org.apache.commons.jexl3.JexlEngine.createScript(JexlEngine.java:411)
{code}
h3. Workaround:
Terminating line 6 with a semicolon ({{{}append(1);{}}}) gets around the error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)