Hacker News new | ask | show | jobs
by Larrikin 1303 days 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.

1 comments

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.
So you're in the exact same case as you were in Java, which was my third point. But the type is a special type to let you know what you're doing is unsafe.