Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.6.5
-
Component/s: groovy-jdk
-
Labels:None
-
Number of attachments :
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
Fixed