Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0-beta-9
-
None
-
None
-
Windows XP
Description
A statically typed variable in a method cannot be assigned an
incompatible type. However, the same code works dynamically
when used outside a method. See following:
def doSomething() {
int age = 25
//age = "youthful" // ERROR: cannot cast 'youthful' to an Integer
println "Age: ${age}"
}
doSomething() // call it
// do same at outer level
int age = 25
age = "youthful" // OK: dynamic typing permitted here
println "Age: ${age}"
Attachments
Issue Links
- is depended upon by
-
GROOVY-761 static typing
- Closed