mengnankkkk commented on code in PR #2701:
URL: https://github.com/apache/fory/pull/2701#discussion_r2412897660


##########
java/fory-core/src/main/resources/META-INF/native-image/org.apache.fory/fory-core/reflection-config.json:
##########
@@ -5,5 +5,18 @@
     "allPublicConstructors": true,
     "allDeclaredMethods": true,
     "allPublicMethods": true
+  },
+  {
+    "name": "jdk.internal.reflect.ReflectionFactory",

Review Comment:
   We can create a fory-graalvm-feature module specifically to adapt to the 
GraalVM Native Image environment. They need to depend on both fory-core and 
fory-graalvm-feature in the project. When they run the native-image build 
command, GraalVM automatically discovers and runs ForyGraalVMFeature through 
Service Loader, obtains all registered classes in Fory, identifies those 
"problematic classes" that rely on ReflectionFactory in the JVM, and registers 
the "blank instance" creation capability with GraalVM for the "problematic 
classes". In order to ensure that the subsequent field filling is correct, all 
fields can be registered at the same time for reflective write operations. 
Provide an entry point in fory-core to switch to using ForyGraalVMFeature. 
fory-core needs to expose static methods such as isProblematicForCreation. This 
is my design. You can add to it.



-- 
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