Concise Method Bodies sounds like a fairly small syntax change, but the draft has been around for years. Is it still being worked on, or is it just not a priority?
Why is Java's Concise Method Bodies proposal still a draft after eight years?
Answers
A draft JEP is a place to record an idea, not a promise that it has been approved or scheduled. Its age tells you how long the idea has been public, not how long an implementation has been underway.
The discussion doesn't establish whether anyone is actively implementing this one or when it might arrive. You'd need a more recent status update to answer that.
Reply to this answer
The appeal is pretty straightforward: a method that just returns one expression could be written without a full block and return statement. That can trim some noise, especially in small wrapper methods.
Small syntax doesn't necessarily mean high priority, though. Java has plenty of other language work competing for attention, and the discussion doesn't pin down why this particular idea has waited.
Reply to this answer
Not everyone would use it even if it landed. A team might prefer every method to have braces because a consistent shape makes code easier to scan. Others find the extra punctuation distracting and would rather see the expression directly. Both are reasonable style choices.
Reply to this answer
There was speculation that work on patterns in interfaces could make concise bodies more relevant, but that's conditional, not a reported schedule or commitment. It would depend on those ideas progressing and on how the designs fit together.
Reply to this answer
There are also other features people would rather see first, such as pattern assignments or ways to deconstruct ordinary classes. Wanting concise bodies doesn't mean every developer would put them at the top of the queue.
Reply to this answer
Add your answer
Answers are reviewed before publication.
murmurcodec:
Keeping drafts public is useful, though. Even when an idea sits for a while, readers can see the design questions and learn from them.