Menu

#626 Kotlin: can't find enclosing method with private interface method

v5.3
closed-works-for-me
None
High
2019-12-06
2016-10-31
No

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

Discussion

  • Eric Lafortune

    Eric Lafortune - 2016-12-18

    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?

     
  • Eric Lafortune

    Eric Lafortune - 2016-12-18
    • status: open --> open-works-for-me
    • assigned_to: Eric Lafortune
     
    • Kirill Rakhman

      Kirill Rakhman - 2016-12-19

      I've updated all dependencies in the branch "proguard626" and the error still persists. Please make sure, you're not building from master.

       
  • T. Neidhart

    T. Neidhart - 2019-12-06
    • status: open-works-for-me --> closed-works-for-me
    • Priority: 5 --> High
     
  • T. Neidhart

    T. Neidhart - 2019-12-06

    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.

     

Log in to post a comment.