0
How Kotlin Concerted To Java?
My question is we can make android apps by many languages like java, kotlin, javascript etc But when we make app in java and then we decompile it then we can see the code of java. But let's suppose we have make app in kotlin but when we decompile the app made with Kotlin then it still show code in java. We can see many apps coded in different languages but how we can see only java code? I have doubt how these languages are converted to java if anyone have answer to my question please answer.👍
2 ответов
+ 7
Both Java and Kotlin compile to JVM's bytecode. The decompiler only knows how to take the bytecode and display Java. Given Kotlin generates a different bytecode pattern than Java, it is unlikely the decompiler will be successful in generating runnable code. Though many of the simpler patterns will be the same.
+ 1
The work of decomplile - The goal of the "Decompile" button is to help people understand how the Kotlin compilation works. The Java code it generates is not intended for use as actual production code (and is quite poorly suited for that - to begin with, it does not always compile.
Why we need to convert it - To understand what is really going under the hood
To investigate performance issues
To get rid of Kotlin from our project
Here's a sample for you - import kotlin.Metadata;
import kotlin.ranges.IntProgression;
import kotlin.ranges.IntRange;
import kotlin.ranges.RangesKt;
@Metadata(
mv = {1, 1, 15},
bv = {1, 0, 3},
k = 2,
d1 =
{"\u0000\u0006\n\u0000\n\u0002\u0010\u0002\u001a\u0006\u0010\u0000\u001a\u00020\u0001"},
d2 = {"printEvenNumbers", ""}
)
public final class SampleKt {
public static final void printEvenNumbers() {
byte var3 = 0;
IntProgression var10000 = RangesKt.step((IntProgression)(new IntRange(var3, 10)), 2);
int i = var10000.getFirs