dokka
dokka copied to clipboard
[K2] KMP: JS legacy-compiled libraries do not work for Kotlin <1.9.0
The JS integration test has unresolved types for Kotlin less 1.9.0. For Kotlin 1.9.0 and later, the test is passed.
Blocked by: https://youtrack.jetbrains.com/issue/KT-64159
Action point:
- mention in
known issuesfor K2 opt-in release - decide afterwards on priority
In our integration test:
HTMLAnchorElement is unresolved. It is from stdlib. However, other classes from the react library are resolved.
In Kotlin 1.9.20, KGP passes kotlin-stdlib-js-1.9.20.klib and kotlin-react-18.2.0-pre.490.klib
In Kotlin 1.8.20, despite using js(IR), KGP passes kotlin-stdlib-js-1.8.20.jar, which is legacy-compiled(see the comment below) ,and kotlin-react-18.2.0-pre.490.klib.
The old compiler backend has been deprecated since Kotlin 1.8.0. Starting with Kotlin 1.9.0, using compiler types LEGACY or BOTH leads to an error.
The AA cannot read legacy-compiled JS libraries.
Note: KGP 1.9.0-1.9.10 passes kotlin-stdlib-js-1.9.0.jar/kotlin-stdlib-js-1.9.10.jar as well, but kotlin-dom-api-compat contains HTMLAnchorElement.
The kotlin-stdlib-js-*.jar has both the legacy and IR content, but AA filters out .jar here.
The possible workaround is to add new stlib/kotlin-dom-api-compat into Dokka's classpath.
implementation("org.jetbrains.kotlin:kotlin-stdlib-js:2.0.0")
implementation("org.jetbrains.kotlin:kotlin-dom-api-compat:2.0.0")
<1.9.0 is quite old version so it is closed as obsolete