org.jspecify.annotations.*; public class SomeJavaClass { @NonNull public String foo() { ... } @Nullable public String bar() { ... } } Java Kotlin val sjc = SomeJavaClass() sjc.foo().length sjc.bar() ?. length Raises an error in the default strict mode because the result is nullable. To avoid the error, use ?.length instead