Hi, I have Java API that I want to make “Kotlin Friendly”.
I was hoping to just annotate the relatively few methods that return null with @Nullable. This mostly works apart from the issue that when I use auto-complete in IDEA the return type defaults to a nullable type (which I then have to manually change to a non-nullable type).
To make my Java API “Kotlin Friendly” with the correct non-nullable type provided correctly by IDE auto-complete it seems I need to annotation those methods with @NotNull. This is 99% of my methods.
Ideally I could have a class level @NotNull annotation (target ElementType.TYPE) that indicates that all the methods on this class return non-null types EXCEPT for the ones that are explicitly annotated with @Nullable (and there are only 1 or 2 of those so this would be good).
Does anyone have something like this?
Is there a ‘plan’ for having some target ElementType.TYPE level @NotNull annotation (or even package level) that I could use on Java API’s?
In particular I note that @NotNull from org.jetbrains:annotations:15.0 … does not target ElementType.TYPE but maybe I have missed something?