-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nullability annotations for better Kotlin support #140
Comments
Hello @connyduck, good to see you here again. Currently, we are migrating to new Kontent.ai services (in this particular case new GitHub organization and Maven package identification). Once we finish that, I will reach out with the proposal. Do you have a suggestion on which nullability annotation would be the best to use? |
One more question - what are the most important classes you wold like to see the nullability annotation first? |
I don't really care since they all work they same for consumers.
How about starting with the |
Motivation
The Kentico Delivery Client and its model are treated as platform types in Kotlin, which makes them harder to use and increases the possibility of accidental NullPointerExceptions.
Proposed solution
All public methods have annotations on parameters and return types so that the Kotlin compiler can correctly infer their nullability and prevent unchecked use of nullable types.
This is also an improvement for Java callers, usually tools emit a warning when nullability is handled the wrong way.
Additional context
Nullability Annotations supported by the Kotlin compiler and more info how calling Java from Kotlin works: https://kotlinlang.org/docs/java-interop.html#nullability-annotations
The text was updated successfully, but these errors were encountered: