OpenJDK is Planning to Make Java Coding Easier
There has been a new plan proposed for OpenJDK to give Java a local-variable type of inference capability. This will allow us to write code easier while continuing with static type safety.
This plan was proposed earlier this month in JEP (JDK Enhancement Proposal (JEP) 286. The documentation regarding it currently doesn't cite a version of Java where the proposed improvements will be featured.
The proposal states:
We seek to improve the developer experience by reducing the ceremony associated with writing Java code while maintaining Java's commitment to static type safety by allowing developers to elide the often-unnecessary manifest declaration of local variable types.
The JEP stresses:
Java is nearly the only popular statically typed language that has not embraced local-variable type inference. At this point, this should no longer be a controversial feature.
I've heard Java developer complain almost constantly regarding the volume of boilerplate coding required for an application.
According to the JEP:
Manifest type declarations for locals are often perceived to be unnecessary or even in the way; given good variable naming, it is often perfectly clear what's going on. The need to provide a manifest type for every variable also accidentally encourages developers toward overly complex expressions; with a lower-ceremony declaration syntax, there is less disincentive to break complex chained or nested expressions into simpler ones.
Their plans would be restricted to local variables with initializers, indexes in the for-loop, and locals declared in traditional for-loops.
Quantitatively, we want that a substantial percentage of local variable declarations in real code bases can be converted using this feature, inferring an appropriate type.
OpenJDK is a free and open source Java SE implementation that is also backed by Oracle. Java SE 9, the official version and next generation of the platform, is due in just a year now. The JEP is endorsed by Oracle's Mark Reinhold, Chief Architect of the Java Platform.