Working on updating to Kotlin 1.9.20 from 1.8.21. ...
# javascript
b
Working on updating to Kotlin 1.9.20 from 1.8.21. I'm getting the following error running
jsTest
(but not
jvmTest
).
Copy code
IrLinkageError: Constructor 'RhovasSpec.<init>' can not be called: Can not instantiate abstract class 'RhovasSpec'
    at throwLinkageError (C:\dev\Rhovas\Interpreter\build\compileSync\js\test\testDevelopmentExecutable\kotlin\js-ir\runtime\unlinked.kt:11:11)
    at main (C:\dev\Rhovas\Interpreter\build\js\packages\Interpreter-test\kotlin\Interpreter-test.js:552:5)
    ...
The linked compilation output is this.
Copy code
function main() {
  var tmp = TestEngineLauncher_init_$Create$().withProjectConfig_bmospl_k$([]).withJs_d0wdap_k$();
  throwLinkageError("Constructor 'RhovasSpec.<init>' can not be called: Can not instantiate abstract class 'RhovasSpec'");
}
Changing the class to be
open
(instead of
abstract
) results in the following compiler error:
Copy code
java.lang.IllegalStateException: IrSimpleFunctionPublicSymbolImpl for dev.rhovas.interpreter/main|main(){}[0] is already bound: FUN name:main visibility:public modality:FINAL <> () returnType:<unbound IrClassPublicSymbolImpl>
	at org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.bind(IrPublicSymbolBase.kt:69)
	at org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl.<init>(IrFunctionImpl.kt:49)
Since
jvmTest
is fine, this is very likely a JS IR compiler bug. Tracing through previous versions, this also occurs on both 1.9.0 and 1.9.10, however it only shows the full stacktrace with 1.9.20 FWIW; I'm using Kotest as well and there's some JS-specific things here to workaround a bug so that adds some complexity to this. The class is defined here. Any ideas? As-is this would block me from updating and the theoretical workaround (
open class
) doesn't work.
t
./gradlew clean
?
In some cases manual cache cleanup can be required
b
I did try that with
abstract class
and it doesn't work, but looks like clean does fix the illegal state exception with
open class
, which at least unblocks me. I opened a ticket for this: https://youtrack.jetbrains.com/issue/KT-63399/Kotlin-JS-IrLinkageError-Constructor-can-not-be-called-can-not-instantiate-abstract-class