top | item 33707884

(no title)

sedro | 3 years ago

Kotlin interops nicely with Java but it's not null-safe (all references from Java are assumed non-null).

discuss

order

Larrikin|3 years ago

That is wrong all, non annotated Java code gets a special type denoted with a ! . You can use ?. or assign it to a new val with ?: return.

Or you throw all the null safety away and write unsafe java code but in Kotlin the same as the Java code you're working with.

sedro|3 years ago

You can use ?. or assign to a nullable type. Or you can get a NPE at runtime. Which is to say, it's not null-safe.