In this recipe, we are going to learn how to easily decompile our Kotlin files to see how their corresponding JVM bytecode is implemented and what the bytecode's corresponding Java implementation would look like. This can help you to discover how various Kotlin concepts were implemented under the hood. It can also be helpful for code-debugging and optimization.
Decompiling Kotlin code to Java and JVM bytecode
Getting ready
Let's create a new Kotlin file, named Recipe4.kt, that contains the following sample implementation in order to see its bytecode translation:
data class A(val a: String = "a") {...
companion object {
@JvmStatic
fun foo(): String = "Wooo!"
}
}