Laurent Laborde
09/06/2022, 5:37 AMAndreyVanDenHaag
09/06/2022, 5:52 AM?
you explicitly make it non-nullable.ephemient
09/06/2022, 6:06 AMString
is non-nullable, String?
is nullable. types coming from Java have unknown nullability unless they have a recognized annotation, https://kotlinlang.org/docs/java-interop.html#null-safety-and-platform-typesephemient
09/06/2022, 6:06 AM<T>
in Kotlin, without further constraints, it does not have a specified nullability. you can use a constraint such as <T : Any>
to ensure it is always a non-nullable type, or write T?
or T & Any
(the latter is new in Kotlin 1.7) to make specific use-sites nullable or non-nullableStephan Schroeder
09/06/2022, 6:33 AMLaurent Laborde
09/06/2022, 9:37 AMLaurent Laborde
09/06/2022, 9:39 AMLaurent Laborde
09/06/2022, 9:45 AM