Accessors

Buwanta Som buwantasom at outlook.com
Sun Sep 20 13:35:24 UTC 2020


Hello, I'd like to ask why Records are not used as a chance to remove the need of using accessor methods.
As they are completely new, I believe they should use "accessor fields" or something like that when modification of the return value is needed, to remove the need for calling a method every time you need the value of a field. Personally, I use classes with public final fields for this purpose. It is cleaner and makes more sense.
I want to know why there is no plan to invent fields as accessors specifically for Records, as they're not released yet.
Once they are released Java will be locked basically forever to using accessor methods. Records are great for reducing verbosity when creating such classes but they don't do much to reduce verbosity of using them. If they are made this way then any future solution to the JavaBeans getter setter method problem will also only be useful for defining, not using and indirectly useful features such as += will be blocked for that kind of solution.

Sorry if this is the wrong place, I've never used mailing lists before.


More information about the amber-spec-comments mailing list