igor.wojda
11/19/2020, 8:51 AM// 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 🤔Rob Elliot
11/19/2020, 9:00 AM@NotNull
and @Nullable
annotations are there.Rob Elliot
11/19/2020, 9:06 AMigor.wojda
11/19/2020, 9:27 AMrobstoll
11/19/2020, 9:58 AM