Consider the following:
class C {
String foo
void setFoo(String foo) { this.foo = foo }
}
@groovy.transform.CompileStatic
class D {
void meth(C c) {
c.foo += 'x'
c.with {
foo += 'y'
}
}
}
"c.foo += 'x'" infers as "setFoo" whereas "foo += 'y'" infers as "getFoo" (if it exists) or just property "foo".
Consider the following:
"c.foo += 'x'" infers as "setFoo" whereas "foo += 'y'" infers as "getFoo" (if it exists) or just property "foo".