Hi, I've written a small Groovy script that exposes a very weird behaviour. can anyone explain it ?
// Creating a groovy map
def map = [:]
// Putting a value in
map["a"]="b"
// Render it without trouble
println map["a"]
// Putting another value in (yup, this one has THE name)
map["metaClass"]="c"
// Failing to render it
println map["metaClass"]
My question in that case is quite simple : why does the last instruction will throw the exception below :
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'c' with class 'java.lang.String' to class 'groovy.lang.MetaClass'
at Script1.run(Script1.groovy:8)