Expanding LVTI support for Lambda Parameters in Java 11

Java 10 allows implicit typing for local variables. You can get a quick refresher here.

Fast forward 6 months, Java 11 will be supporting local variable syntax support for Lambda Parameters in an implicitly typed lambda expression.

Here is an example from the spec:

(var x, var y) -> x.process(y)

 

With this support, annotations can be added to local variables as they require full type.

(@NotNull var x, @Nullable var y) -> x.process(y)

Expanding the example from my earlier post. Lines #17 and #57 shows this support in action.

Java 11 is releasing next month! IntelliJ IDEA 2018.2 has already added support for this feature.

Screen Shot 2018-08-20 at 1.05.40 AM

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s