I am migrating my program from Scala to Kotlin. I replaced some functionality (immutable collections etc) with Guava. Obvious problem is a nullability, my Kotlin code is full of exclamation marks. This is not neccessary, Guava uses @Nullable annotations and all nullability info is there.
Problem is explicit/implicit nullable declaration. For Kotlin all Java code is nullable, unless @Nonnull is used. For Guava everything is nonnull, unless @Nullable is used.
So my question: is there a way to tell Kotlin Compiler that some java package is Null Safe? I would like an option to switch Null Safety from explicit to implicit on per package basis.
I know about external Kotlin annotations, but it does not support package wildcards.
Also I know about generics and collections problem (
fun File.listFiles(): Array<File?> ). I am not trying to solve this, external Kotlin annotations would be still needed in this case.