I’m using moshi which accesses the Kotlin default constructor of a class by reflection.
The class looks like this:
@JsonClass(generateAdapter = true)
data class AClassName(
val threadId: String,
val title: String? = null
)
If I use “View bytecode” in Android Studio I can see the constructor does in fact exist:
public synthetic <init>(Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
To try and keep it I add
-keep @com.squareup.moshi.JsonClass class * {
<init>(...);
}
However, r8 removes it anyway, keeping only the non-synthetic constructor. Does anyone know why?