4 ms·
Have your tried static analysis? When I used Java most (if not all) of our NPE problems were pointed out by sonar qube
by flatiron 4y ago
Have your tried static analysis? When I used Java most (if not all) of our NPE problems were pointed out by sonar qube
- ris58h 4y agoWhat if I don't want to put @Nullable/@NotNull all over the code?
- seer-zig 4y agoCan't you setup your project to be `@NotNull` by default, and explicitly mark @Nullable fields? Those should be more rare anyway.
- cies 4y agoYes. But coupled with our Groovy templates (that we're now moving to Kotlinx.html) it did not really help much. This is not Java's problem per se (though one could argue that J's verbose syntax prohibits it for in-code HTML templating)
- hn_throwaway_99 4y agoUgh, to hear what hackarounds folks have to deal with in the Java ecosystem is kind of frightening. I moved from Java to Node (then Typescript) about 8 years ago. Moving to a language that doesn't allow implicit nulls makes a world of difference, importantly, at "programmer" time, not just build time. That is, when programming in VSCode, I immediately get feedback if I attempt to use a nullable variable in an unsafe manner. That has huge productivity benefits compared to if I only got that feedback after my build ran. Similarly, simple things like safe optional chaining (i.e. foo?.bar?.baz) makes code so much faster and easier to write, and AFAIK this hasn't been added to Java yet (correct me if I'm wrong).