Hey In my library (that will be distributed) I have simple Kotlin data class where some of the properties are nullable
// Kotlin class
data class Test(
val name: String,
val lastName :String?
)
// Generated Java class src
public final data class Test public constructor(name: kotlin.String, lastName: kotlin.String) {
}
Since this class will be also used from Java is there any way to include
Nullable
and
NonNull
annotations in generated the code for the properties? Something like this:
// Generated Java class src
public final data class Test public constructor(@NonNull name: kotlin.String, @Nullable lastName: kotlin.String) {
}
(I mostly care about
NonNull
):
The main drive for this behaviours is that now I can create new instance of
Test
class from Java and pass null values
new Test(null, null)
without any indication that this is wrong/undesired usage- I believe with annotations IDE would display error/waring 🤔