gudzpoz opened a new issue, #2669:
URL: https://github.com/apache/fory/issues/2669

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) 
and found no similar issues.
   
   
   ### Version
   
   OS: ArchLinux (6.16.7-zen1-1-zen)
   Fory: 'org.apache.fory:fory-core:0.13.0-SNAPSHOT'
   Failing JDK: GraalVM 23.0.2+7.1 (build 23.0.2+7-jvmci-b01)
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   Clone [the reproducer 
project](https://github.com/gudzpoz/fory-native-image-reproducer/tree/ensure-custom)
   
   Reproducing steps:
   
   ```console
   $ git checkout subclass-fields
   $ ./gradlew run # pass
   $ ./gradlew nativeCompile
   $ app/build/native/nativeCompile/test # fail
   Exception in thread "main" org.apache.fory.exception.SerializationException: 
java.lang.RuntimeException: Class class org.example.App$Custom is not registered
           at org.apache.fory.Fory.processSerializationError(Fory.java:371)
           at org.apache.fory.Fory.serialize(Fory.java:340)
           at org.apache.fory.Fory.serialize(Fory.java:288)
           at org.example.App.main(App.java:24)
           at 
[email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
   Caused by: java.lang.RuntimeException: Class class org.example.App$Custom is 
not registered
           at 
org.apache.fory.resolver.TypeResolver.getSerializerClassFromGraalvmRegistry(TypeResolver.java:600)
           at 
org.apache.fory.resolver.ClassResolver.getSerializerClass(ClassResolver.java:854)
           at 
org.apache.fory.resolver.ClassResolver.getSerializerClass(ClassResolver.java:846)
           at 
org.apache.fory.resolver.ClassResolver.createSerializer(ClassResolver.java:1252)
           at 
org.apache.fory.resolver.ClassResolver.getOrUpdateClassInfo(ClassResolver.java:1174)
           at 
org.apache.fory.resolver.ClassResolver.getRawSerializer(ClassResolver.java:839)
           at org.example.AppForyRefCodec_0.<init>(AppForyRefCodec_0.java:54)
           at 
org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:241)
           at 
[email protected]/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:102)
           at 
[email protected]/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:0)
           at 
[email protected]/java.lang.invoke.Invokers$Holder.invoke_MT(Invokers$Holder)
           at 
org.apache.fory.serializer.Serializers.newSerializer(Serializers.java:101)
           at 
org.apache.fory.resolver.ClassResolver.createSerializer(ClassResolver.java:1253)
           at 
org.apache.fory.resolver.ClassResolver.getOrUpdateClassInfo(ClassResolver.java:1174)
           at org.apache.fory.Fory.write(Fory.java:412)
           at org.apache.fory.Fory.serialize(Fory.java:334)
           ... 3 more
   ```
   
   GitHub workflow reproducer: 
https://github.com/gudzpoz/fory-native-image-reproducer/actions/runs/18038616597/job/51331417582
   
   ### What did you expect to see?
   
   The test should pass.
   
   ### What did you see instead?
   
   `java.lang.RuntimeException: Class class org.example.App$Custom is not 
registered` when the serializer has been registered.
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] 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]

Reply via email to