Backwards compatibility on Kotlin 1.1, Kotlin reflection?


#1

I have a project built with Kotlin 1.0.6 with a couple of references.

I succesfully manage to migrate to Kotlin 1.1.0-beta-38 without any major compile problems except the following:

Some runtime JAR files in the classpath have an incompatible version. Remove them from the classpath or pass the correct ‘-language-version’ explicitly. Alternatively, you can use ‘-Xskip-runtime-version-check’ to suppress this error
[ERROR] /Users/jco27/.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.0.3/kotlin-reflect-1.0.3.jar: Runtime JAR file has version 1.0 which is older than required for language version 1.1
[ERROR] -> [Help 1]

This error comes from a dependency introduced by:

<dependency>
        <groupId>com.fasterxml.jackson.module</groupId>
        <artifactId>jackson-module-kotlin</artifactId>
        <version>2.8.4</version>
</dependency>

as jackson actually uses the reflection module and it is compiled into 1.0.6

Other than building the module myself manually, how can that issue be solved? I find it a little bit alarming that I can’t use a library create with 1.0.6 on 1.1.


#2

This issue is fixed in the upcoming Kotlin 1.1 RC. Such projects will now compile and run correctly.


#3

Thank you @yole, when is that expected to be out?


#4

Thanks @yole I indeed tested that with 1.1-rc-89 and it works correctly. Hoping 1.1 final comes out soon :slight_smile:


#5

A workaround is to provide an explicit dependency on kotlin-reflect of version 1.1, for example:

<dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-reflect</artifactId>
        <version>1.1.0-beta-38</version>
</dependency>

#6

1.1 RC is out now.