APK→JAR conversion emits invalid bytecode for Kotlin 2.x extensions (InstantiationError: kotlin.jvm.internal.Lambda)
Summary
Extensions built by keiyoushi after their Kotlin 2.x / Mihon 0.20 migration fail to install on Suwayomi with java.lang.InstantiationError: kotlin.jvm.internal.Lambda. Root cause: the APK?JAR conversion emits a literal new kotlin/jvm/internal/Lambda instruction where the original Android build constructs the concrete subclass. On current Suwayomi runtimes kotlin.jvm.internal.Lambda is abstract (generic Lambda<R>), so the invalid new throws InstantiationError.
Environment
- Suwayomi-Server v2.3.2243 (stable) and v2.3.2333 (preview) � both affected
- Java 21.0.8 (bundled JRE), Windows x64
- Extension:
eu.kanade.tachiyomi.extension.en.flamecomicsv1.4.50 (keiyoushi)
Reproduction
- Install any post-migration keiyoushi extension (e.g. flamecomics v1.4.50)
- Install fails with:
Caused by: java.lang.InstantiationError: kotlin.jvm.internal.Lambda
at y.<clinit>(Unknown Source)
at eu.kanade.tachiyomi.extension.en.flamecomics.ExtensionGenerated.<init>(Unknown Source)- Same APK works fine on Mihon/J2K (Android ART loads the extension with its own bundled stdlib)
Evidence
Converted jar inspection (extensions/tachiyomi-en.flamecomics-v1.4.50.jar):
- 71 entries, zero
kotlin/classes (conversion drops the bundled stdlib) javap y:
public final class y extends kotlin.jvm.internal.Lambda implements kotlin.jvm.functions.Function0
public static final y a;
static {};- Runtime failure at
y.<clinit>: the emittednew kotlin.jvm.internal.Lambdaresolves against the server's abstractLambda<R>? InstantiationError - Verified with multiple Kotlin stdlib versions injected via a child-first classloader (1.9.0, 2.2.10, 2.2.21, 2.3.10, 2.3.20, 2.4.0) � all fail identically, confirming the emitted instruction itself is invalid for current runtimes
- Windows Event Log shows the JVM dying natively in unrelated KCEF cases, but this specific failure is a clean Java-level InstantiationError
Impact
Every keiyoushi extension built after the Kotlin 2.x migration fails to install on any published Suwayomi release (stable and preview). This blocks the whole Mihon-extension ecosystem on Suwayomi going forward.
Expected
The APK?JAR conversion (and/or its bytecode patching step) should emit new y (the concrete generated lambda subclass) � or otherwise handle Kotlin 2.x lambda shapes � so extensions load against the server-provided stdlib.
Happy to provide the converted jar, the original APK, or test candidate fixes against our instance.
Source: Suwayomi/Suwayomi-Server