I've just migrated some of my libraries to 1.4 and...
# scripting
a
I've just migrated some of my libraries to 1.4 and I am using IR for JVM. I am getting
Copy code
ERROR Class 'hep.dataforge.workspace.WorkspaceBuilder' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler (script.kts:3:1)
java.lang.IllegalStateException: ERROR Class 'hep.dataforge.workspace.WorkspaceBuilder' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler (script.kts:3:1)
when interpreting a script from string. Why is that?
The mentioned class is compiled with the same compiler, but is placed in the different module.
u
We don’t yet support .kts compilation in the JVM IR backend (this is work in progress), so the compiler falls back to the old backend. And dependencies from the old backend to the code compiled with IR backend are not allowed in 1.4, because the ABI generated by the IR backend is not yet completely the same and we didn’t want to end up in the binary compatibility hell scenario. So in this case you have the following options: 1) Revert to the old backend in these libraries 2) Fix this error by making these libraries appear as if they’re compiled by the old backend. For this, you can provide
-Xir-binary-with-stable-abi
in builds of the libraries. But this might be risky in case of said ABI differences, and I don’t recommend this, especially if your libraries have external users 3) Suppress this error by allowing the old backend to depend on IR-generated libraries. For this, you can provide
-Xallow-jvm-ir-dependencies
at the point where the script is being interpreted If you choose option 2 or 3, please be prepared for possible breakages when updating to future Kotlin 1.4.* versions
a
Thank you very much for the explanation. I had to revert to old backend anyway, but it is nice to understand this point.