Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.6.5
-
None
Description
"-1" as Integer
returns -1
however:
a = '-1' "$a" as Integer
gives
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '-1' with class 'org.codehaus.groovy.runtime.GStringImpl' to class 'java.lang.Integer' at Script1.run(Script1.groovy:2)
But you can do it with:
a = '-1' ( "$a" as String ) as Integer
Tim