Proguard can't process this simple code


#1

I’ve found the problem in my codebase and I’ve tried to simplify it to the following snippet:

class DemoProguardIssue {
    fun main() {
        with(Unit) {
            runLambda {
                runLambda {

                }
            }
        }
    }
    private fun runLambda(lambda: () -> Unit) = lambda()
}

Proguard complains with this error and breaks my build

Warning: com.example.DemoProguardIssue$main$1$1$1: can't find referenced class com.example.DemoProguardIssue$main$1$1

Rewriting the code to avoid the with was an easy workaround for me, but I’m scared there’s a bug in the compiler, or the desugar tool or something.

Can you help me figure out the problem?


#2

Just curious: why do you use “with(Unit)”? What is the purpose?


#3

This snippet is my best effort to simplify the code and still reproduce the issue. In the actual code the with uses another object.
But proguard won’t complain if you remove the useless with(Unit)


#4

I have the same issue, you should file a bug report