Helpful NullPointerExceptions without Java 14!
Exceptional is our solution for those pesky NullPointerExceptions which tell you on which line things went wrong and nothing more. With Exceptional a clear and helpful message explaining which value is null will accompany the NullPointerException. Over are the days staring at a chain of method calls trying to understand which step may have produced a null.
Exceptional adds informative NullPointerExceptions to all versions of Java, starting from Java 5! Obtain useful information with the NullPointerException as shown in the screenshot below. No need to analyse or guess what went wrong, the explanation is right there.
The NullPointerException above was intentionally triggered to illustrate the benefits of Exceptional. The actual unit test case is the one shown below.
NullPointerExceptions can be notoriously hard to diagnose. Exceptional adds the necessary information to understand the cause of a NPE’s quickly.
Speedup development and training
You increase the pace of development when developer no longer have to stare at stracktrace to understand what caused a NullPointerException.
For all Java versions
JEP 358 added Helpful NullPointerExceptions to the Java runtime as of Java 14. Exceptional brings the same benefits to those of us who can not yet transition the Java14 (or higher).
How many NullPointerExceptions can you find?
Take a look at the lookup() method below. From line 54 to say 56 there are no less that 3 potential NPE’s hidden in this otherwise simple method.
The unit tests fail1(), fial2() and fail3() are there to illustrate each possible NPE. Answers illustrated below….
Here are the answers. On the left the answers without Exceptional. As you can see you, you still have some staring to do to try and understand what went wrong. Or you can save yourself some time and look at the result on the right. Here the benefit of Exceptional becomes clear. The stacktrace is exactly the same but now you know right away what caused the NPE!
Full IntelliJ IDEA Integration
The Exceptional plugin, currently in BETA, integrates seemlessly in the IntelliJ.