Unexpectedly, Groovy is not calling the setter in response to an assignment statement

Suppose that, in an app, I declare a method

def setFoo(x){
    //do some stuff here

and then, elsewhere, in some other method where there is no variable named 'foo' declared in the method body, I write

foo = 1;

I would expect that my statement foo = 1 would be equivalent to setFoo(1).

However, this does not seem to be the case. Instead of invoking setFoo(), Groovy simply creates a new variable named 'foo' -- the same thing that Groovy would do in the absence of a setFoo() method.

Any thoughts?

I'm not super keen on all of the groovy goodness but I have a feeling what you are seeing is probably because a setter may need to be declared on an object and referenced from an object (non-static). Your setter might work if you called it off the driver instance maybe? If we had a reference to that... But I'm guessing you need to reference it like [var].foo = 1 instead of just foo = 1. You know what I mean?
Getters/setters are for fields or properties. That's just me guessing.

Good thought. In the case of an app (or a driver too, I would think), the object of which foo is a field is this. Perhaps this.foo = 1 will be equivalent to calling the setter.

Did this work? I feel like I tried to reference this once and it didn't work. Like, they'd disabled it somehow.