----- Mail original ----- > De: "Maurizio Cimadamore" <maurizio.cimadam...@oracle.com> > À: "Alex Buckley" <alex.buck...@oracle.com>, "amber-spec-experts" > <amber-spec-experts@openjdk.java.net> > Envoyé: Jeudi 20 Septembre 2018 22:28:42 > Objet: Re: JEP draft: Concise Method Bodies - extend this to local functions?
> On 20/09/18 21:22, Alex Buckley wrote: >> On 9/20/2018 1:08 PM, Maurizio Cimadamore wrote: >>> On 20/09/18 17:32, Remi Forax wrote: >>>> There is also a potential confusion between >>>> Function<A,B> fun() = Utils::bar; >>>> and >>>> Function<A,B> fun() -> Utils::bar; >>>> >>> You meant between >>> >>> Function<A,B> fun() = Utils::bar; >>> >>> and >>> >>> Function<A,B> fun = Utils::bar; >>> >>> ? >>> >>> (first is method body, second is variable initializer) >> >> I think Remi is noting the fact that, when using `->`, the single >> expression can be a method reference expression. I have already >> recorded this situation near the end of the JEP. yes, but in your example the return type is not the same, i prefer mine class Utils { Function<String,String> fun() = this::bar; Function<String,String> fun2() -> this::bar; Function<String,String> bar() { return null; } String bar(String s) { return null; } } > Ok - then I added another :-) [not sure we should be worried about it, > but perhaps worth mentioning in the JEP] > Rémi