Java 14 – “NullPointerExceptions are a significant improvement”

Share
  • March 26, 2020

JAXenter: What do you think is the most important new feature in Java 14?

For me, Java has already been pretty much complete since Java 8.

Michael Vitz: This time I find it difficult to name a single highlight. For the language itself, the highlight is probably the preview of records which make the creation of classical Java beans extremely easy. Apart from that, I think the new NullPointerExceptions are great because they support me in a very unexcited way and without me having to do anything.

SEE ALSO: Hands on with Records in Java 14 – A Deep Dive

JAXenter: What feature do you think is missing in Java 14?

Michael Vitz: To be honest, I don’t know. For me, Java has already been pretty much complete since Java 8. Now and then, I will notice that something was missing when I see a new feature, but all in all, nothing stands out for me acutely at the moment.

JAXenter: Will your customers update right away or is that not worth it? 

Michael Vitz: Many of my customers have just upgraded from JDK 8 to 11 and will most likely not immediately upgrade to 14. Probably, most of them will wait for JDK 17 and thus switch to the next release with long-term support.

JAXenter: What difficulties could it pose to immediately use the new Java version in production? 

Many of my customers would like to receive updates for a longer period of time.

Michael Vitz: I think it’s all about trust. Although the people developing the JDK always emphasize that upgrading from e.g. 13 to 14 is only a small step, it is not perceived as such. Many of my customers would like to receive updates for a longer period of time.

In addition to the JDK update, libraries, build tools and the IDE need to be updated as well. And by now, deprecated parts are really being removed from the JDK, which can lead to additional work.

JAXenter: What is your opinion on “JEP 371: Hidden Classes”, which may be included in one of the upcoming Java versions? 

Michael Vitz: Since I primarily build applications with Java, and rather rarely frameworks, I hope that this feature has little effect on me. The promise that classes generated by frameworks will not appear in stack traces can be helpful and make stack traces a bit more readable. I am willing to be positively surprised.

JAXenter: With features like “JEP 358: Helpful NullPointerExceptions“, is Java approaching “modern” languages like Kotlin? 

Kotlin’s concept of dealing with null is much more sophisticated and is already included in the compiler.

Michael Vitz: I find the new NullPointerExceptions a significant improvement. They eliminate the need to guess which variable was null and can be really helpful in troubleshooting. But I don’t think that Java is approaching Kotlin with exactly this feature. Kotlin’s concept of dealing with null is much more sophisticated and is already included in the compiler.

But, in general, you can see that the JDK is drawing from concepts that have been tried and tested in other languages, including Kotlin. I really like this because it allows the language to evolve without having to test every new feature completely on its own.

JAXenter: What wishes/preferences do you have for Java 15, set for release later this year? 

Michael Vitz: Just recently, I realized that the HTTP client, which has been available since JDK 11, lacks a concept to filter outgoing requests or incoming responses. This would, for example, allow you to add a header with a trace ID automatically before sending. It would be great if this could be added, but I don’t think it is on the JDK’s radar yet.

SEE ALSO: Java 14 – “A shorter release cycle creates the feeling that the language is constantly evolving”

JAXenter: In general, what do you think about the acceleration of Java with the six month release cycle?

Michael Vitz: Even though the new model has not yet become established in practice with my clients, I like the acceleration. It especially gives the JDK developers the possibility to receive feedback much earlier on. In combination with the experimental features, this approach greatly increases the probability of developing good APIs and language features.

The post Java 14 – “NullPointerExceptions are a significant improvement” appeared first on JAXenter.

Source : JAXenter