Yes, this is going to be a rant post!
If you are in sync with the recent developments happening in/around open jdk you might have come across the JEP-286 | Local-Variable Type Inference
This JEP has been authored by none other than Brian Goetz and endorsed by Mark Reinhold himself(Yikes!).
I will straight away come to the points why I(no-one) vehematically (n:vehement) oppose this improvement!
- Code is read more than just written.
- There is max context when someone is writing an implementation for a method! All context needs to be dumped then and there. By bringing in this change, all this context will be lost for ever!
- This change introduces the idea of “I know its suppose to return X”, there will be no way to verify the claim, except the compiler-interpretation.
- Such changes belittle the language semantics! Well remember this: Milk of a lioness can be held in a gold container only else it goes sour! Java respects this semantics as of now! (Its really cool!).
- You can leverage power of automatic type suggestions while one is on RHS of the equation/statement, which has given a great boost to the language via lambdas. LHS *has* to be clearly defined.
Following are demo videos showing how easy and quickly one can do an alt-enter in your favorite ide and have the LHS of the assignment automagically inferred!
1/Simple example from the JEP
2/Complex examples using files from the same JEP
There are couple of surveys seeking public opinion on the same here are their links:
Finally, if you have seen Mark’s Java 9 intro speech, he starts off by talking about
1/No copy pasting a feature from any language just because its cool!
This JEP is not only killing Readability, but its not consistent across the language.!? There goes universality and compatibility into the garbage collector!
Let’s just keep evolving without giving up the things that make Java really stand strong on its feet! #DieJEP286