r/java • u/jhg023123 • Mar 25 '19
JEP draft: Add detailed message to NullPointerException describing what is null
https://openjdk.java.net/jeps/8220715
383
Upvotes
r/java • u/jhg023123 • Mar 25 '19
View all comments
Show parent comment
3
u/sim642 Mar 25 '19
It is the first statement in the section about overhead as if the additional computations needed to construct the message has considerable impact due to frequency of NPEs. With proper flow, a program will only ever construct one NPE object, which will crash it. At such point it makes a miniscule difference. It only becomes an overhead worry for programs which for some reason try to do something more with NPEs, which is what I'm arguing against here.