Hello, :slightly_smiling_face: has anyone noticed ...
# build-tools
l
Hello, 🙂 has anyone noticed differences with minification and Kotlin 1.8.0 (kotlin-gradle-plugin)? I'm building an Android library with minified enabled and the resulting class files are completely different from Kotlin 1.7.2. Example using 1.7.2 and minify
Copy code
public final class Test public constructor() {
    public final fun addOne(num: <http://kotlin.Int|kotlin.Int>): <http://kotlin.Int|kotlin.Int> { /* compiled code */ }

    public final suspend fun suspendAddOne(num: <http://kotlin.Int|kotlin.Int>): <http://kotlin.Int|kotlin.Int> { /* compiled code */ }
}
Same code after using 1.8.0 and minify
Copy code
public final class Test {
    public static final int $stable;

    public Test() {
    }

    public final Object suspendAddOne(int var1, Continuation<? super Integer> var2) {
        return Boxing.boxInt(var1 + 1);
    }

    public final int addOne(int var1) {
        return var1 + 2;
    }
}
In 1.8.0, I am also getting an extra parameter variable with suspend functions. I can't find any documentation or logs about this change (looked at kotlin, gradle, and minify/R8 release pages). If anyone could point me in the right direction it would be greatly appreciated!
e
the
Continuation
parameter has always been there in all versions, that's how `suspend fun`s are implemented. how are you inspecting the class files?
l
I'm using the android studio APK analyzer to inspect the aar files. In the above examples, I was using Android Gradle Plugin version 7.4.0, but after upgrading that to 7.2.0, I was actually able to get the same result with Kotlin 1.8.0 and 1.7.20, with no
continuation
parameter seen in the APK analyzer.
Thanks for taking a look! 🙏
e
it's possible that the version of kotlinx.metadata pulled in by the plugin affects whether it understands how recover the signature of the
suspend fun
or not. but that's purely for display, it's always there in the bytecode. you can use low-level tools like
javap
or
baksmali
to see
🤔 1
👀 1
l
Ah I see. I'll try those tools out next time! Thanks!