New JEP: Concise Method Bodies
Alex Buckley
alex.buckley at oracle.com
Wed Sep 19 19:54:40 UTC 2018
Right. A concise method body is introduced with an arrow or equals sign,
and concluded with a semicolon. It just so happens that the concise
method body below features a switch expression, which (unusually among
expressions) has a block of its own. (And that's why I chose it as an
example, to stress the concise-method-body feature.)
Alex
On 9/19/2018 12:49 PM, Remi Forax wrote:
> oops,
> no, the ';' is necessary here, sorry.
>
> Rémi
>
> ----- Mail original -----
>> De: "Remi Forax" <forax at univ-mlv.fr>
>> À: "mark reinhold" <mark.reinhold at oracle.com>
>> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
>> Envoyé: Mercredi 19 Septembre 2018 21:40:41
>> Objet: Re: New JEP: Concise Method Bodies
>
>> There is a ';' at the end of dayOfWeek that should not be there.
>>
>> String dayOfWeek(int d) -> switch (d) {
>> case 1 -> "SUNDAY";
>> case 2 -> "MONDAY";
>> ...
>> }; // <---- should be removed
>>
>>
>> Rémi
>>
>> ----- Mail original -----
>>> De: "mark reinhold" <mark.reinhold at oracle.com>
>>> À: "Alex Buckley" <alex.buckley at oracle.com>
>>> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
>>> Envoyé: Mercredi 19 Septembre 2018 20:54:46
>>> Objet: Re: New JEP: Concise Method Bodies
>>
>>> 2018/9/19 11:42:16 -0700, alex.buckley at oracle.com:
>>>> https://bugs.openjdk.java.net/browse/JDK-8209434
>>>
>>> Or, more readably: http://openjdk.java.net/jeps/8209434
>>>
>>> - Mark
More information about the amber-spec-experts
mailing list