New JEP: Concise Method Bodies

Kevin Bourrillion kevinb at
Fri Oct 5 20:03:44 UTC 2018

On Thu, Sep 20, 2018 at 5:47 PM Tagir Valeev <amaembo at> wrote:

Yes, it's a little bit hard to migrate between block body - expression body
> - method reference. However we already have this problem in lambdas, and we
> are living with this without much hassle. That's because every decent IDE
> can convert between these forms for you.
> Btw IDEA has an action to convert Kotlin block method body to expression
> form and vice versa. If course we will add similar feature for Java.

I should clarify that when I talk about the hassles of going back and forth
between two equivalent ways of doing the same thing, the mechanical cost in
keystrokes is just one part of it, and I'm not even claiming it's a big
part. There's also

- Having to decide which to use
- Having to decide how much to care about consistency between a series of
similar constructs (should I change them all because I'm changing one?)
- Having wider diffs when reviewing or merging
- Discussions developing about "why did you do it this way and not that way"

These are all reasons why having two ways to do the same thing is

Sometimes the advantages of having two ways to do the same thing outweigh
those factors. I believe this happens when:

- Both ways have compelling use cases for when it is a *substantially* better
- How to *tell* which way is better is easy for users to learn and remember

This shows why arrowform switch clears the bar. It's easy to remember "just
use arrowform unless I need fallthrough", and it's clearly substantially
better to do so.

I would like to see this JEP make a much clearer case for why it also
clears this bar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amber-spec-experts mailing list