3 ms·
> I remain unclear on the value (haha) of the @Nullable and @NotNull annotations. If it's not baked into the language, why bother? What's the difference betwee
by pron 11y ago
> I remain unclear on the value (haha) of the @Nullable and @NotNull annotations. If it's not baked into the language, why bother?
What's the difference between "baked into the language" and a language with built-in support (added in Java 8) for pluggable, inferrable type systems (of which @NotNull is just one, pretty basic, example)?
- specialist 11y agoIn principle and practice, I oppose all use of annotations. It's metaprogramming (aka magic). Being the new COBOL, Java is best when it just works. Anyone who can use annotations responsibly will be happier choosing a grown up language like Clojure. In truth, I don't have an answer for why method?method?property syntax is better than using annotations. Because I tend to use NullObjects and avoid method chaining, to me it's a false choice. Edit: Concision.
- pron 11y ago> I oppose all use of annotations. It's metaprogramming (aka magic). Don't conflate annotations (a compile time construct) with how they can be used. They can be used in many ways. When used as runtime metadata they can be "magic". But @Nullable/@NonNull is (or rather, can be used as) one of Java 8's pluggable type systems, inferred and and checked at compile time[1]. [1]: http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#nullness-checker http://types.cs.washington.edu/checker-framework/current/che...