Community
Participate
Working Groups
I've just improved an API to return @NonNull and as a result found that many if guards were redundant, As I removed them I suddenly had a doubt; how can I tell whether a null guard is deliberately or accidentally missing? How do I know to reintroduce the deliberately missing null guards if the invoked code changes to require them again? Solution: put an explicit @NonNull on each local variable whose non-nullness is exploited. Suggestion for enforcement. Provide a compiler option to give me a warning for usage of a probably but unannotated non-null variable. This is just the same as a missing @Override. If the underlying code changes I get a warning. Ditto, if the invoked @NonNull API changes I will get a warning.
Moving to JDT/Core for comment.