There is a bunch of new features in this release, but I have a clear personal favourite: local variable inference. Just have a look:
1 | var obvious = 1; |
What is the type of obvious?
Over time we evolved a bit:
1 2 3 4 |
There is, naturally, a catch: where are the generics in the last example? I think it’s fair not to expect the compiler to use a crystal-ball.jar, so
1 | var generics = new ArrayList<String>(); |
Generics will be a
1 | ArrayList<String>(); |
now, as expected. One last catch – this will trigger IntelliJ et al to suggest returning an ArrayList instead of List, but I guess this will get better over time.