You are currently viewing How does Kotlin backward compatibility work?

How does Kotlin backward compatibility work?

I’m struggling to understand how Kotlin compatibility works. The common knowledge is, because Kotlin compiles to JVM bytecode. So if I’m authoring a kotlin library (let’s call it libA) the only 2 things that should control compatibility are:

  • Which JVM bytecode version I configure kotlinc to compile to
  • Which kotlin-stdlib I depend on

But then when I use libA in a project that’s getting compiled with an older kotlin compiler I get an error such as:

libA was compiled with an incompatible version of Kotlin 1.6, expected version is 1.4. 

Both projects compiling against the same JVM version.

What does that mean?

Can anyone shed some light into the things at work when it comes to kotlin compatibility?

submitted by /u/amr-mostafa
[link] [comments]