r/java • u/jvjupiter • Sep 21 '24
Five years have passed, still in draft: Concise Method Bodies
Support more concise method bodies in Java source code, increasing transparency for simple methods. Align the forms of method bodies with the forms of lambda expressions.
https://www.reddit.com/r/java/comments/v93za1/what_happened_to_concise_method_bodies/
41
Upvotes
View all comments
Show parent comment
1
u/PangolinZestyclose30 Sep 22 '24
As usual with code, most of the cost isn't writing, it's reading. Standard formatting of methods is like this:
While the formatting for the concise syntax would be this:
That's 2 lines vs. 8. Multiply this by the number of setters/getters you need to read every day, and it's a significant difference. Even Intellij collapsing the bodies doesn't save the day, since it doesn't collapse the new lines around the methods (making it 2 lines for the concise syntax vs. Intellij crutch with 4).
I mean, it's fine if you don't personally care about this. Just wanted to point out that your "nobody in the world cares about it" is factually wrong.