|
|
|
|
|
by mrkeen
1004 days ago
|
|
> these days with @NotNull and powerful editors like IDEA stopping you from doing dumb things I'm so sick of these half-arsed "features" that somehow get adopted into Java code bases. Stop what you're doing and go write a unit test for @NotNull (or @NonNull). Watch the null value happily bypass those "checks". Or, use (or write) a notNull() method (I happen to use commons-lang3) and watch it actually work. |
|
I mean you can literally assign nil to a "func" type, and then call that func and it'll panic at runtime. Neither the compiler nor the JetBrains IDE will warn you about that, and there are no @Nonnull type annotations you can add (even if they're not ideal as you rightly point out).
That literally happened to me last week, just a stupid coding mistake, but took quite a while to find. In Java IntelliJ would have probably warned me about that, and certainly if I'd added @Nonnull annotations.