JEP proposed to target JDK 11: 323: Local-Variable Syntax for Lambda Parameters
Zheka Kozlov
orionllmain at gmail.com
Fri Jan 26 09:59:38 UTC 2018
The motivation is to allow `final` and annotations on lambda parameters:
(final var x) → x + 1;
(@Nonnull var x) → x + 1;
This is impossible to write with an implicitly typed lambda:
(final x) → x + 1; // Illegal
(@Nonnull x) → x + 1; // Illegal
2018-01-26 15:30 GMT+07:00 Martijn Verburg <martijnverburg at gmail.com>:
> Hi all,
>
> I'm struggling to understand the motivation for this JEP in terms of it
> adding improved understanding or readability of source code (as the
> implicit case is already covered today).
>
> I also suspect the illegal use uses (extract below) will likely confuse and
> frustrate day to day developer's who don't understand the underlying type
> inference system and lead to
> some heavily upvoted SO Q's. I liken this type of frustration seen in
> developers not understanding generics in full and coming undone in corner
> cases where they expect the element of
> 'least surprise'.
>
> ------
>
> The following examples are illegal:
>
> (var x, y) -> x + y // Cannot mix var and "no var" in
> implicitly typed lambda expression
> (var x, int y) -> x + y // Cannot mix var and manifest types in
> explicitly typed lambda expression
>
>
> -------
>
> I'm not sure I've explained myself very eloquently here, hope this has made
> some sense.
>
> Cheers,
> Martijn
>
> On 26 January 2018 at 08:40, <mark.reinhold at oracle.com> wrote:
>
> > The following JEP is proposed to target JDK 11:
> >
> > 323: Local-Variable Syntax for Lambda Parameters
> > http://openjdk.java.net/jeps/323
> >
> > Feedback on this proposal is more than welcome, as are reasoned
> > objections. If no such objections are raised by 23:00 UTC on Thursday,
> > 1 February, or if they're raised and then satisfactorily answered, then
> > per the JEP 2.0 process proposal [1] I'll target this JEP to JDK 11.
> >
> > - Mark
> >
> >
> > [1] http://cr.openjdk.java.net/~mr/jep/jep-2.0-02.html
> >
>
More information about the jdk-dev
mailing list