Replies: 2 comments
-
To answer your initial question, no, we do not have plans to introduce this. I could defintely see us using it if it was built into the language or standardized in some way though. |
Beta Was this translation helpful? Give feedback.
-
Well, there's JSR-305 as far as standardization goes. With Java 8 they decided to go with I personally use SpotBugs' annotations set, which aren't in the However, if using an external analyzer isn't desirable, you can always create two empty annotations with the two names mentioned earlier and have Eclipse use them to check for nullability (see the first link in the earlier comment). |
Beta Was this translation helpful? Give feedback.
-
That would allow static analysis in Eclipse and other IDEs, and through both gradle and CI pipelines (see SpotBugs, PMD, Qodana, and so on).
Since all of this is annotation-driven, you don't have to add annotations to each and every method right away, but you can introduce them with new code first and then go on from there. I understand that deprecating all the old code that doesn't use
Optional<T>
is not really viable, so annotations are the next best thing IMHO.As an added bonus this would help the two or three of us who use non-Java JVM languages for writing extensions, where nullable and non-nullable variables are two separate things :)
Beta Was this translation helpful? Give feedback.
All reactions