News for hackers. Stuff that matters.
Re:Add detailed message to NullPointerException describing w... by paulmd on Tuesday March 26, 2019 @01:05PM (#19493734)
A lot of those NullExceptions (and a lot of boilerplate code) could be linted away if Java gave compiler-level semantics to @NotNull annotations.

Letting null values propagate through your program is frequently a code smell, you want to constrain it at the boundaries of your program logic if possible. Unfortunately, Java does not have a semantic way to do this, just documentation and discipline.

Re:Add detailed message to NullPointerException describing w... by mrighele on Tuesday March 26, 2019 @02:24PM (#19494614)
Checker framework [1] can be used to add compile time checks on such annotations. Unfortunately I found it non trivial to setup (that was some time ago though, I'll have to check again). I noticed also that a recent version of Wildfly application server can do those check at runtime, but I haven't investigated it enough to see if it is configurable and the performance impact of the checks [1] https://checkerframework.org
Re:Add detailed message to NullPointerException describing w... by joe_fishfish on Tuesday March 26, 2019 @02:36PM (#19494741)
Kotlin is amazing for this.
Re:Add detailed message to NullPointerException describing w... by pron on Tuesday March 26, 2019 @02:44PM (#19494823)
As Java supports pluggable type systems, this can be achieved by one: https://checkerframework.org/manual/#nullness-checker