New JEP: Concise Method Bodies

Kevin Bourrillion kevinb at google.com
Fri Oct 5 20:03:53 UTC 2018


On Mon, Sep 24, 2018 at 10:17 AM Alex Buckley <alex.buckley at oracle.com>
wrote:

On 9/21/2018 4:07 PM, Kevin Bourrillion wrote:
> > "The method reference form can use most kinds of method references after
> > the = sign: static and unbound method references, bound method
> > references (if the receiver *variable* is in scope for the method
> > declaration)"
> >
> > Can we still bind to any expression?
> >
> >    private String a(String b, int c)
> >        throws SomeCheckedException = *d.e()*::f;
>
> No limitation is intended on the receiver, as long as the method
> reference expression would be legal if it appeared in the traditional
> body of method `a`. (Details of this translation remain to be worked out.)
>

Can the expression before the :: refer to any method parameters? Of course,
it would still expect to pass those parameters into the method, so it's
*weird* to have the same parameter used in both ways, but does it make
sense to forbid it?


-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20181005/dffb6358/attachment.html>


More information about the amber-spec-experts mailing list