How is interop achieved?
Kotlin is primarily a JVM language and therefore is compiled to standard JVM bytecode by the Kotlin compiler. This bytecode is what is actually run by the Java Virtual Machine to execute our programs. Because this resultant bytecode is familiar to JVM developers and tools, it can be integrated and manipulated using known techniques. This is largely how Kotlin can work so seamlessly with Java.
When Kotlin is compiled for the JVM, the underlying bytecode is the same as if you had written Java code. To maintain compatibility with multiple versions of Java, the Kotlin compiler is capable of generating Java 6- and Java 8+-compatible versions of JVM bytecode. This means that tools built to support Java through the examination ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access