Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.7.7
-
None
-
None
-
Groovy 1.7.7 on Windows XP x86
Description
The type declaration of the iterator variable in a for-loop seems to be ignored:
List l = ['aaa'] // contains one String try { for (Integer i in l) { // iterator declared Integer (not assignable from String!) // GroovyCastException expected in assignment to i in the previous line assert false // we should not get this far, expected GroovyCastException } } catch (org.codehaus.groovy.runtime.typehandling.GroovyCastException e) { assert true // expected exception }
Exception thrown
07.02.2011 17:33:40 org.codehaus.groovy.runtime.StackTraceUtils sanitize
WARNUNG: Sanitizing stacktrace:
Assertion failed:
assert false // we should not get this far, expected GroovyCastException