How to update kotlin compiler embedable? - kotlin

I have common library with own libraries and build tools for gradle. Like SDK. I updated kotlin to 1.2.71. All ok. I also updated kotlin dsl to newest RC release(no effect).
Then I have projects, which are using this mine SDK. Problem ocurred, when I switched to version 1.2.71 on those projects, because "BuildUtilKt.makeModuleFile" was removed.
Unable to find method 'org.jetbrains.kotlin.incremental.BuildUtilKt.makeModuleFile(Ljava/lang/String;ZLjava/io/File;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/io/File;'.
or
Unable to find method 'org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments.setCommonSources([Ljava/lang/String;)V'.
I know how to remove dependencies, when I have it in compile, but I don't know where from I am getting "kotlin-compiler-embeddable:1.2.41"
Tried:
- compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.2.71") in buildSrc
- runtime "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.2.71"
it doesn't work.
Here are printed dependencies: gist

Related

Class 'my.example.Class' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler

I am using IntelliJ, I published a library but when I try to use it, I get the warning: Class 'my.packge.MyClass' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler.
I am using the same build.gradle.kts on both projects, same kotlin version (1.6.21).
The weirdest part is that if I do build, the projects build just fine without any error.
Any suggestions on what could be going on?
Seem to be Kotlin's bug:
https://youtrack.jetbrains.com/issue/KTIJ-21563
Watch it in order to be notified once it has updates. See this article if you are not familiar with YouTrack.

Unresolved Reference Kotlinx in IntellijIdea. Even after adding the library

I just wanted to taste Kotlin coroutines. Unfortunately, I haven't been able to use the library kotlinx in IntelliJ. I have downloaded the library through Maven.
Tried invalidating caches.
Rebuilt project.
Tried using it in a fresh project.
Even IntelliJ is suggesting kotlinx in auto-completion.
Still it says unresolved reference
I have tried most of the solutions on the web. But nothing worked.
Here are the steps that I am exactly doing.
Made a new project.
kotlinx is underlined since the library has not been added.
In project structure > modules > dependencies > add > library > maven Searched for the kotlinx library.
Downloaded the library.
Applied the settings.
kotlinx library is now visible in the External Libraries section.
Even the auto-completion is now suggesting kotlinx.
Still, nothing changes. The result is the same.
I have found the answer in the Kotlin slack channel. And to solve this particular issue add org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0 instead of org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0.
However, it is generally a good idea to learn a build system like Gradleor Maven and using those in the project. It makes life a lot easier.

Intellij-idea Debugger - Coroutine tab : "An error occurred on fetching information"

I'm trying to do some coroutine example represented on : https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-basic-02.kt
and It's debugger not working properly.
As you see, even code about coroutine like 'runBlocking' or 'launch' is not detected by intellisense,
I don't know what is my problem.
First my project is kotlin Console program, and
What I've done to import kotlinx.coroutine to my project are :
at Project Structure, Module downloaded org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-RC from Maven, when downloading checked Trasitive-something and Source, and added at library.
at Settings -> Build -> Kotlin compiler, changed language version and API version to 1.5, which is experimental version of Kotlin
at Project tool and build.gradle.kts, added
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-RC") at dependencies,
kotlin("jvm") version "1.5.0" at plugins
Just run projects works well, but I can't use any context menu when using code about coroutine and as you know, it's really annoying me. any help would be appreciated.
I had the same problem but it seems to be fixed in 1.5.0. See https://youtrack.jetbrains.com/issue/KTIJ-11620
I meet this problem today, I use the latest the Coroutine library version and my kotlin version is 1.6.21 which is not the latest.
I just update my kotlin version to the latest version 1.8.10.

The binary version of its metadata is 1.0.1, expected version is 1.1.0

In intellij idea 16 EAP 144.3357.4 I have a pure Kotlin cmd project currently refusing to run with this error:
The binary version of its metadata is 1.0.1, expected version is 1.1.0
The project runs on the command-line - I invalidated caches and restarted Idea - nothing helped. Anyone had the same problem and found a way to get it working?
The problem seems to be mismatch between the kotlin library used in your project and the version of the plugin are not compatible.
Check the Kotlin plugin version and you'll most likely see something similar to:
Version: 1.0.0-rc-1007-IJ143-11
Then check the version of the Kotlin libraries by looking into META-INF/build.txt or META-INF/MANIFEST.MF and it'll most likely be other version like 1.0.0-beta-4589.
To resolve the problem update Kotlin libraries to version 1.0.0-rc-1007 which can be found in this maven repository: https://dl.bintray.com/kotlin/kotlin-eap.
Kotlin compiler marks each .class with #kotlin.Metadata to indicate, among others:
The version of the bytecode interface (naming conventions, signatures) of the class file annotated with this annotation.
That is how the compiler detected incompatibilities.

IntelliJ Datanucleus Enhancer plugin not working

The project I'm developing uses Datanucleus 2.0.3, so I'm using those libraries for enhancement (plugin is configured to use the module dependencies as well). IntelliJ version 12.0.1 on a Ubuntu 12.4 machine. I know the 2.0.3 is ancient history but upgrading it at least now is not an option for me.
From gradle all works fine. I imported by project to IntelliJ and when I ran the tests from junit I got the usual ClassNotPersistenceCapableException so I recalled I need a plugin for this.
I installed the newest plugin (tried both the beta and the last stable version) and configured the plugin to enhance my this one module. I chose JDO and applied, it discovered all the classes annotated for persistence, I rebuilt the whole project, ran the tests again and the same error occurs.
some things I've noticed / checked:
- the Enchaner is ticked in "Build / Datanucleus Enhancer"
- looked for multiple datanucleus jars, but there is only one
- haven't seen any message in IntelliJ in the Event Log saying is has done enhancing (the gradle enhancer logs such a message)
- haven't seen any error messages in IntelliJ saying enhancement failed, I also didn't find any log files outside IntelliJ (should there be any?)
- when I manually added the gradle built classes at the top of the classpath for the test the tests passed - but this is no good
- the module has the following datanucleus 2.0.3 jars on it's classpath: datanucleus-core, datanucleus-enhancer, datanucleus-connectionpool, datanucleus-rdbms and the asm-3.1.jar (the dependencies say it's 3.0-4.0 so this one should fit)
I have no idea why it sees the classes but doesn't enhance them, or maybe it does try and silently fail ... but then I don't know how to diagnose the problem
No other ideas come to my mind, please advise what to check or what to try.