This is basically a bug in Java. In many other languages ​​(Python, Delphi, Groovy), the compiler will generate getters and setters for you if you do not provide the code.
This means that you can use the “public” field in Groovy, and the compiler will silently generate and call setter / setter. If you need to do extra magic when changing the field, you can enter a specialized setter, and everything will work.
This is one of those things where reality is confronted with design. The Java developers did not want the compiler to do everything that you do not see. What seemed like a good idea many years ago did not work out too well.
Aaron Digulla Aug 13 '09 at 15:16 2009-08-13 15:16
source share