-
Notifications
You must be signed in to change notification settings - Fork 10
Groovy
StefanosChaliasos edited this page Feb 5, 2021
·
3 revisions
- Use-site variance
https://docs.groovy-lang.org/latest/html/documentation/core-semantics.html#type-inference
It is worth noting that although the compiler performs type inference on local variables, it does not perform any kind of type inference on fields, always falling back to the declared type of a field.
- Local Variables: Y
- Fields: X
void doSomething(def o) {
if (o instanceof Greeter) {
println o.greeting()
}
}