Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.9, 2.2.1
-
None
Description
This script fails:
testMethod() @groovy.transform.CompileStatic def testMethod() { def root = new ConfigObject() def list = ["1", "2", "3", "4"] as String[] assert list[0..<0] == [] assert list[0..<-1] == ["1", "2", "3"] println list }
The error is:
Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '0..<0' with class 'groovy.lang.EmptyRange' to class 'groovy.lang.IntRange' due to: org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method <init>() to invoke from this list: public groovy.lang.IntRange#<init>(int, int) protected groovy.lang.IntRange#<init>(int, int, boolean) public groovy.lang.IntRange#<init>(boolean, int, int) org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '0..<0' with class 'groovy.lang.EmptyRange' to class 'groovy.lang.IntRange' due to: org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method <init>() to invoke from this list: public groovy.lang.IntRange#<init>(int, int) protected groovy.lang.IntRange#<init>(int, int, boolean) public groovy.lang.IntRange#<init>(boolean, int, int) at groovyBugs.testMethod(groovyBugs.groovy:8) at groovyBugs.run(groovyBugs.groovy:1)