Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.0-JSR-5
-
None
-
None
-
WinXP SP2
Description
------------------------------------------------------------
def list = [1,2,3,4,5,6,7,8,9]
println list[99] // null is returned
println list[-99] // throws java.lang.ArrayIndexOutOfBoundsException
------------------------------------------------------------
Stack trace:
Caught: java.lang.ArrayIndexOutOfBoundsException: Negative array index [-99] too large for array size 9
at test.run(test.groovy:5)
at test.main(test.groovy)
To me, this seems to be inconsistent behavior for two similar expressions.