It seems the groovy also support the compiling mode, using groovyc
, If I run the following code with dynamic script calling way, I will get "String" method called.
Why I still got "String" even if I compiled the code using groovyc
? The type of variable a is "Object", so I expected after compiling the code, I will get the "Object" function called.
Object a = "123"
def foo(Object a) {
println "Object"
}
def foo(String a) {
println "String"
}
foo(a)