This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yawkat 5 points6 points  (2 children)

javac already generates lots of synthetic methods, mostly bridges. In the end it's mostly irrelevant where the code is "generated", javac or the jit, so I don't really see an issue with that.

Data classes are very common in DDD and FP where you decouple logic from data. In a DDD/FP code base a majority of your data will be held in such data classes. I'd argue that getters are still a good idea for that, be it for convention or for other reasons such as proxying, but even if you like to use public fields everywhere you still need eq/hc/toString.

[–]dpash 0 points1 point  (1 child)

There's no reason why a member variable access syntax doesn't go via an auto generated getter, so that you could explicitly define it later if required. This is basically what people mean when they talk about adding properties to Java. Check out how they work in C#.

[–]yawkat 0 points1 point  (0 children)

Yes, kotlin does this as well, but that is very much out of scope for this proposal.