4 ms·
> do you find any value in nullable / non-null annotations Hah! Annotations. They're tales told by idiots, full of sound and fury, signifying nothing. But ser
by dehrmann 7y ago
> do you find any value in nullable / non-null annotations
Hah! Annotations. They're tales told by idiots, full of sound and fury, signifying nothing.
But seriously, they're about as meaningful as reading the javadoc. At least Optional enforces the contract; it's just clunky.
- smoyer 7y ago@NonNull etc are not completely meaningless ... if you run SpotBugs it can be set up to fail your build if the contract specified in the annotations isn't met. I love static analysis!
- iainmerrick 7y agoYou can configure your IDE to warn of incorrect usage, and you can configure your compiler to flag warnings as errors. That will catch a lot of potential problems at compile time. It’s not perfect but it can be lot better than nothing. Java annotations are better than Optional when you’re interoperating with Kotlin code, such as when you’re partway through converting a large codebase to Kotlin.