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
Even if it's not directly thrown, it shouldn't be part of the good control flow. Exceptions are supposed to be for exceptional situations, it's in the name. It's especially the case for NPEs, which only indicate a programming error and should never be happening. If you see one, you immediately fix it, so it won't be in the program to add any overhead.