Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added info about why Groovy do not gen getter and setter for public field, answer quoted from Guillaume's email

...

Note that properties need some kind of identifier: e.g. a variable type ("String") or untyped using the "def" keyword.

Why a field with public access modifier do not have getter and setter generated? If we'd generate getter / setter all the time, it means Groovy would
not let you not define getters / setters, which can be problematic when you really don't want to geters / setters to be exposed.

Closures and listeners

Though Groovy doesn't support anonymous inner classes, it is possible to define action listeners inline through the means of closures. So instead of writing in Java:

...