ably-java icon indicating copy to clipboard operation
ably-java copied to clipboard

Consider whether to add nullability annotations

Open QuintinWillison opened this issue 5 years ago • 3 comments

In particular for our public APIs, but would also assist internally in some places too.

This section in the Java interoperability section of the Kotlin docs presents a nice summary of the options we could adopt.

I had previously asked sacOO7 to remove Jetbrains annotations when he added them in one of his PRs, but that was more because I didn't want to conflate this with that particular fix.

Working on this issue has three clear components:

  1. Select which annotations to use
  2. Add them to our public APIs
  3. Possibly add them our internal APIs

┆Issue is synchronized with this Jira Research by Unito

QuintinWillison avatar Dec 22 '20 14:12 QuintinWillison

Just to add my two cents - I am not sure about web and enterprise Java developers, but afaik in Android world de-facto standard is JetBrains annotations. Because of that I suggest we use them as well, unless there is a strong reason not to.

kavalerov avatar Dec 23 '20 15:12 kavalerov

+1 @kavalerov . I can see it being used almost everywhere too. The only issue would be we need to configure it to generate an error via a plugin when it violates null contracts. Currently, IDE can only generate warnings when null constraints are violated.

sacOO7 avatar Feb 25 '21 04:02 sacOO7

I've just been creating an interface in our Asset Tracking Android product which is meant to wrap the ably-java SDK. I found myself having to use my knowledge of our SDKs in order to make judgements about nullability. If we had these annotations I wouldn't have needed to do that. All that is to say this sounds like a good idea 👍.

lawrence-forooghian avatar Dec 28 '22 19:12 lawrence-forooghian