For my first blogpost I decided to write about a new small feature in Java 17. The new NullPointerException.
Actually this is not new. But the content is much more informative than usual.
Many people know the problem when a NPE appears. Either you know directly where the problem is or you start debugging. In the best case you write your code in a way that there is no possibility that a npe appears. For all the other risk takers out there, there is the NullPointerException.
Starting with version 17 of java, it was decided to adapt the stacktrace. The information that is now supplied seems to indicate relatively precisely at which point NULL is passed in.
Exception in thread "main" java.lang.NullPointerException:
Cannot assign field "i" because "a" is null
For all who want to get more infomation about this I recommend the official JDK JEP-Page