You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a class has multiple constructors it can happen that for some of them, unused parameters are removed. When several constructors have the same descriptor afterwards, ProGuard has to fix that by introducing some synthetic parameters to distinguish them from another.
Now this can lead to situations where the constructor whose parameter has been removed will become the new parameterless constructor, and the original constructor has some additional parameter.
This can have multiple effects: the original parameterless constructor might be made private, and a different constructor might be called when the class is dynamically created.
A simple example to illustrate the problem is this kotlin class:
class MyService(
private val foo: String = "bar",
private val bar: Intent = Intent()
) : Service() {
override fun onBind(intent: Intent?): IBinder? = null
}
As there are default values, the kotlin compiler will create additional synthetic constructors whose parameters might get removed.
When using Proguard on the class with optimization enabled, the original parameterless constructor is made private.
The text was updated successfully, but these errors were encountered:
The problem lies in the DuplicateInitializerFixer that is run after parameters have been removed.
The fixer checks if there are multiple constructors with the same descriptor, and fixes it by adding an additional parameter to one of these constructors. Unfortunately there is no precedence which constructor gets modified (if none is kept), the one that has been modified in the step before should be used to avoid such problems.
When a class has multiple constructors it can happen that for some of them, unused parameters are removed. When several constructors have the same descriptor afterwards, ProGuard has to fix that by introducing some synthetic parameters to distinguish them from another.
Now this can lead to situations where the constructor whose parameter has been removed will become the new parameterless constructor, and the original constructor has some additional parameter.
This can have multiple effects: the original parameterless constructor might be made private, and a different constructor might be called when the class is dynamically created.
A simple example to illustrate the problem is this kotlin class:
As there are default values, the kotlin compiler will create additional synthetic constructors whose parameters might get removed.
When using Proguard on the class with optimization enabled, the original parameterless constructor is made private.
The text was updated successfully, but these errors were encountered: