JEP 286: Local-Variable Type Inference: Usage

Artem Ananiev artem.ananiev at
Thu Mar 29 18:36:18 UTC 2018

On 2018/03/29 9:36, Kevin Rushforth wrote:
> As a prerequisite, we would need to update the minimum boot JDK to JDK
> 10, which I was going to propose doing anyway -- it seems the right time
> now that JDK 10 is out.
> I have no objections to then allowing the use of 'var' in new code.
> Do any others have any concerns?

My personal experience with "var"s - they are used a lot in Scala, for 
example - is they make code very unreadable, especially when working 
with collections and streams. The only case when a "var" is suitable is 
new object creation:

var object = new SomeType()

In all other cases they are more painful than valuable.

I can say it differently. It's very easy to use "var"s wrong. No matter 
what style guides are available, people will often use them in a way 
that makes code less readable.

Just my $0.02



> -- Kevin
> Nir Lisker wrote:
>> Hello,
>> A style guide for usage of 'var' has been published at
>> Can we start using
>> this feature in contributions to OpenJFX?
>> - Nir

More information about the openjfx-dev mailing list