dennishendriksen opened a new issue, #2248: URL: https://github.com/apache/fury/issues/2248
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/fury/issues) and found no similar issues. ### Version Fury v0.10.2 and GraalVM 21.0.7 ### Component(s) Java ### Minimal reproduce step content of `src/main/resources/META-INF/native-image/com.example/helloworld/native-image.properties`: ``` Args = --initialize-at-build-time=com.example.helloworld.p3.FuryFactory --trace-class-initialization=com.example.helloworld.p3.FuryFactory_FooFuryCodec_0 ``` this works when creating a native image and `Foo` is a record: ```java package com.example.helloworld.p3; import org.apache.fury.Fury; import org.apache.fury.config.Language; public class FuryFactory { public enum Bar {X} public record Foo(Bar bar) {} public static final Fury fury; static { fury = Fury.builder().withLanguage(Language.JAVA).requireClassRegistration(true).build(); fury.register(Bar.class, true); fury.register(Foo.class, true); } } ``` but the same example does not work when `Foo` is a inner class: ```java package com.example.helloworld.p3; import org.apache.fury.Fury; import org.apache.fury.config.Language; public class FuryFactory { public enum Bar {X} public static final class Foo { private final Bar bar; public Foo(Bar bar) { this.bar = bar; } public Bar bar() { return bar; } } public static final Fury fury; static { fury = Fury.builder().withLanguage(Language.JAVA).requireClassRegistration(true).build(); fury.register(Bar.class, true); fury.register(Foo.class, true); } } ``` ### What did you expect to see? ``` [INFO] BUILD SUCCESS ``` ### What did you see instead? ``` Error: Classes that should be initialized at run time got initialized during image building: com.example.helloworld.p3.FuryFactory_FooFuryCodec_0 was unintentionally initialized at build time. com.example.helloworld.p3.FuryFactory caused initialization of this class with the following trace: Error: Classes that should be initialized at run time got initialized during image building: at com.example.helloworld.p3.FuryFactory_FooFuryCodec_0.<clinit>(FuryFactory_FooFuryCodec_0.java:28) at jdk.internal.misc.Unsafe.allocateInstance(Unknown Source) at java.lang.invoke.DirectMethodHandle.allocateInstance(DirectMethodHandle.java:501) at java.lang.invoke.DirectMethodHandle$Holder.newInvokeSpecial(DirectMethodHandle$Holder) at java.lang.invoke.Invokers$Holder.invoke_MT(Invokers$Holder) at org.apache.fury.serializer.Serializers.createSerializer(Serializers.java:129) at org.apache.fury.serializer.Serializers.newSerializer(Serializers.java:104) at org.apache.fury.resolver.ClassResolver.createSerializer(ClassResolver.java:1232) at org.apache.fury.resolver.ClassResolver.getClassInfo(ClassResolver.java:1125) at org.apache.fury.resolver.ClassResolver.createSerializerAhead(ClassResolver.java:1240) at org.apache.fury.resolver.ClassResolver.register(ClassResolver.java:432) at org.apache.fury.Fury.register(Fury.java:169) at com.example.helloworld.p3.FuryFactory.<clinit>(FuryFactory.java:20) ``` ### Anything Else? _No response_ ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
