Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
While testing with a basic command-line utility, I got the following odd behaviours:
Note: input is denoted by >.
============
> c.e
04-Aug-2009 23:25:46 org.apache.commons.jexl.Interpreter visit
WARNING: org.apache.commons.jexl.scripting.Main.main@51![0,3]: 'c.e;' undefined variable e.e
Return value: null
> c
Return value:
> e
Return value: 2
The error message looks wrong - why is e.e mentioned? Surely it should be c.e?
===========
> a=[1,2]
Encountered " "," ", "" at line 1, column 5.
Was expecting one of:
... etc.
Same for
> A=['b','c']
However, I would expect this to work, as this is the syntax for an array as shown on the website.
How does one create an array?
=====
> D=['a'=>'b']
Return value:
> D['a']
Return value: b
This as expected. However, numbers behave rather oddly:
> E=[1=>2]
Return value:
> E[1]
Return value: null
> E['1']
Return value: null
There does not appear to be a way to access the value.
Whereas, when using a string:
F=['1'=>2]
Return value: {1=2}
F['1']
Return value: 2
F[1]
Return value: 2
In this case, both the string and the bare number are usable as the key.
====
I can create test cases for these, but I'd like to confirm that these are bugs first
Attachments
Attachments
1.
|
Undefined variables not reported correctly | Closed | Unassigned | |
2.
|
Maps do not handle integer keys correctly | Closed | Unassigned | |
3.
|
Array literal syntax is not supported | Closed | Unassigned |