Hi all,
I’m in the process of writing a library for downloading dependencies at runtime. Many people use this to download the Kotlin standard library, with the class calling it written in Kotlin.
A small problem arises when using something like this:
val dependencyManager = PDMBuilder(this).build()
dependencyManager.loadAllDependencies().join()
The Kotlin compiler simply insists upon generating a null check, even though the result of build() is annotated with @NotNull.
To do this, it uses the Intrinsics class, which isn’t present on the classpath yet, causing an error.
I’ve found a reasonably simple workaround which is using the !! operator or returning with the Elvis operator after calling build(), but both of these prompt the “unnecessary operator” warning in the IDE.
Is there a better workaround for doing this? I also found it a little bit tricky to reproduce in a much more simple project.
Thanks