kontent-ai / kontent-ai/java-packages

Add nullability annotations for better Kotlin support

Open
#140 3 comments 0 reactions 0 assignees View on GitHub
hacktoberfest
Dominant language
Java
Stars
17
Forks
27
PR merge metrics
No merged PRs in 30d

Description

### 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

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the Delivery Client and model's public methods, including their parameters and return types, as described in the issue. Determine which nullability annotations are supported by the Kotlin compiler, then verify that Kotlin can infer nullable and non-null types and that Java callers receive appropriate warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.