parseq icon indicating copy to clipboard operation
parseq copied to clipboard

Can we support @Nonnull and @Nullable annotations in public method return values and parameters?

Open hiteshsharma opened this issue 6 years ago • 3 comments

Can we support @Nonnull and @Nullable annotations in public method return values and parameters? Adding these can help parseq users write accurate Parseq code more easily by getting help from IDE in null detection wherever applicable.

If agreed, I can take this task and submit a review.

hiteshsharma avatar Jan 27 '19 07:01 hiteshsharma

This is a question raised before. The problem is that there are multiple versions of @nonull and @nullable annotations, as well as several static analysis tools to handle these annotations like findBugs, Android IDE, etc. When you mention IDE here, do you mean Android developer IDE? Typical IntelliJ IDE will not do null detection for you until you hook up with some static analysis checker tool.

mchen07 avatar Jan 30 '19 06:01 mchen07

Yeah I agree there are multiple versions. We should stick to Java versions (javax.annotation.Nonnull and Nullable). Both IntelliJ and Eclipse have built-in support for null detection using these annotations. No plugin or stylecheck addition required. These annotations are useful even for developers without IDE as they serve as a good documentation and set right expectations for the API.

hiteshsharma avatar Jan 30 '19 21:01 hiteshsharma

How do you compare this annotation with Java Optional?

mchen07 avatar Feb 21 '19 17:02 mchen07