some experiments with Concise Method Bodies

Stephen Colebourne scolebourne at
Mon Oct 15 22:01:44 UTC 2018

On Mon, 15 Oct 2018 at 19:40, Stuart Marks <stuart.marks at> wrote:
> Observations:
> * I was able to use CMB for almost everything. These wrapper classes consistent
> almost entirely of one-liners, to which CMB can be directly applied.

- On the code changes, I'm not a fan of the desire to line up all the
arrows. Why do that when that isn't the general style of the JDK? Was
it to do with readability? What would you do if the code exceeded the
line length?

- I'm not a fan of the throwUOE() approach. If CMB is to go in, I
think "-> throw" would be needed (and should be in lambda too). And
yes, I don't think it should be a full expression usable anywhere.

- Part of the driver was about delegation. But was this change
successful on that measure? There was still redundant code.
Specifically, you still had the full method signatures that you were
delegating even though they are inherited from an interface. Method
parameter names were needed when they didn't matter for example. A
focussed delegate language change might well look quite different,
such as (not taking this too seriously...):

class UnmodList implements List {
  private final List underlying as delegate {
    get(int), size(), isEmpty(), contains(Object), toArray(), toString()

My point being that it is a Good Thing if a language feature is able
to tackle multiple problems. But only if it tackles those problems
well. Does CMB actually tackle multiple different problems well, or
does it prevent better solutions for key use cases?


More information about the amber-dev mailing list