Kotlin: can't find enclosing method with private interface method
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
The following code triggers a fail when compiled with ProGuard:
interface Mixin { fun MainActivity.foo() { bar() } private fun MainActivity.bar() { runOnUiThread { } } }
Warning: com.cypressworks.proguardissue.Mixin$bar$1: can't find enclosing method 'void bar(com.cypressworks.proguardissue.MainActivity)' in program class com.cypressworks.proguardissue.Mixin
See https://youtrack.jetbrains.com/issue/KT-11969
Checkout the following repo to reproduce it: https://github.com/cypressious/KotlinProguardIssue/tree/5e7bacc53800080268969ae8bf299c60758a091f
Thanks for your report and the sample project. Building a release version seems to work fine at this time. The build process is using ProGuard 5.2.1. Can you check?
I've updated all dependencies in the branch "proguard626" and the error still persists. Please make sure, you're not building from master.
This is not a bug. ProGuard reports that the enclosing method information contained in the class generated by the kotlin compiler is not valid. In general such warnings could be ignored. I tested the sample with a more recent kotlin compiler (1.3.31) and the warning is not printed anymore.