-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
While implementing #421 which exposes more standard traits like Eq, Hash, Debug, Display to the bindings, the Kotlin bindings CI failed with:
Error: Exception in thread "main" jdk.internal.org.objectweb.asm.MethodTooLargeException: Method too large: jdk/proxy2/$Proxy4.<clinit> ()V
at java.base/jdk.internal.org.objectweb.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2120)
at java.base/jdk.internal.org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:543)
at java.base/java.lang.reflect.ProxyGenerator.generateClassFile(ProxyGenerator.java:506)
at java.base/java.lang.reflect.ProxyGenerator.generateProxyClass(ProxyGenerator.java:178)
at java.base/java.lang.reflect.Proxy$ProxyBuilder.defineProxyClass(Proxy.java:544)
at java.base/java.lang.reflect.Proxy$ProxyBuilder.build(Proxy.java:657)
at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$0(Proxy.java:429)
at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:427)
at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1034)
at com.sun.jna.Native.load(Native.java:624)
at com.sun.jna.Native.load(Native.java:596)
at iota_sdk.UniffiLib$Companion.INSTANCE_delegate$lambda$0(iota_sdk_ffi.kt:2595)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:86)
at iota_sdk.UniffiLib$Companion.getINSTANCE$iota_sdk(iota_sdk_ffi.kt:5497)
at iota_sdk.Ed25519PrivateKey$Companion.generate(iota_sdk_ffi.kt:21389)
at GenerateEd25519AddressKt.main(GenerateEd25519Address.kt:9)
at GenerateEd25519AddressKt.main(GenerateEd25519Address.kt)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':example'.
> Process 'command '/opt/hostedtoolcache/Java_Oracle_jdk/21/x64/bin/java'' finished with non-zero exit value 1Upon investigation it turned out, that the MethodTooLargException exception is misleading because the issue is not with a single method. The actual issue is that the bindings interface size hits a Kotlin/Java JNA (Java Native Access) specific limitation. This limitation has been encountered before here: mozilla/uniffi-rs#2340 and a bandage on uniffi-rs side has been merged with mozilla/uniffi-rs#2344. This however, could not fix the underlying limitation.
The suggested way to circumvent this in our case is apparently to split up the iota-sdk-ffi crate into multiple, e.g. iota-sdk-types-ffi, etc