This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury.git


The following commit(s) were added to refs/heads/main by this push:
     new 6613de0f fix(java): use serialization binding (#2241)
6613de0f is described below

commit 6613de0fb387de7446c1e6cd52d62b9b776be821
Author: hn <[email protected]>
AuthorDate: Fri May 16 16:29:18 2025 +0800

    fix(java): use serialization binding (#2241)
    
    <!--
    **Thanks for contributing to Fury.**
    
    **If this is your first time opening a PR on fury, you can refer to
    
[CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).**
    
    Contribution Checklist
    
    - The **Apache Fury (incubating)** community has restrictions on the
    naming of pr titles. You can also find instructions in
    [CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).
    
    - Fury has a strong focus on performance. If the PR you submit will have
    an impact on performance, please benchmark it first and provide the
    benchmark result here.
    -->
    
    ## What does this PR do?
    
    <!-- Describe the purpose of this PR. -->
    
    ## Related issues
    
    <!--
    Is there any related issue? Please attach here.
    
    - #xxxx0
    - #xxxx1
    - #xxxx2
    -->
    
    ## Does this PR introduce any user-facing change?
    
    <!--
    If any user-facing interface changes, please [open an
    issue](https://github.com/apache/fury/issues/new/choose) describing the
    need to do so and update the document if necessary.
    -->
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
    
    <!--
    When the PR has an impact on performance (if you don't know whether the
    PR will have an impact on performance, you can submit the PR first, and
    if it will have impact on performance, the code reviewer will explain
    it), be sure to attach a benchmark data here.
    -->
    
    Co-authored-by: hening <[email protected]>
---
 .../apache/fury/serializer/NonexistentClassSerializers.java  |  6 +++---
 .../org/apache/fury/serializer/SerializationBinding.java     | 12 ++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git 
a/java/fury-core/src/main/java/org/apache/fury/serializer/NonexistentClassSerializers.java
 
b/java/fury-core/src/main/java/org/apache/fury/serializer/NonexistentClassSerializers.java
index f5e6584a..c4779dee 100644
--- 
a/java/fury-core/src/main/java/org/apache/fury/serializer/NonexistentClassSerializers.java
+++ 
b/java/fury-core/src/main/java/org/apache/fury/serializer/NonexistentClassSerializers.java
@@ -130,9 +130,9 @@ public final class NonexistentClassSerializers {
             // whether tracking ref is recorded in `fieldInfo.serializer`, so 
it's still
             // consistent with jit serializer.
             Serializer<Object> serializer = classInfo.getSerializer();
-            fury.writeRef(buffer, fieldValue, serializer);
+            binding.writeRef(buffer, fieldValue, serializer);
           } else {
-            fury.writeRef(buffer, fieldValue, classInfo);
+            binding.writeRef(buffer, fieldValue, classInfo);
           }
         }
       }
@@ -140,7 +140,7 @@ public final class NonexistentClassSerializers {
         Object fieldValue = value.get(fieldInfo.qualifiedFieldName);
         boolean nullable = fieldInfo.nullable;
         if (fieldInfo.trackingRef) {
-          fury.writeRef(buffer, fieldValue, fieldInfo.classInfoHolder);
+          binding.writeRef(buffer, fieldValue, fieldInfo.classInfoHolder);
         } else {
           binding.writeNullable(buffer, fieldValue, fieldInfo.classInfoHolder, 
nullable);
         }
diff --git 
a/java/fury-core/src/main/java/org/apache/fury/serializer/SerializationBinding.java
 
b/java/fury-core/src/main/java/org/apache/fury/serializer/SerializationBinding.java
index 80c0267c..6d8840ad 100644
--- 
a/java/fury-core/src/main/java/org/apache/fury/serializer/SerializationBinding.java
+++ 
b/java/fury-core/src/main/java/org/apache/fury/serializer/SerializationBinding.java
@@ -41,6 +41,8 @@ interface SerializationBinding {
 
   void writeRef(MemoryBuffer buffer, Object obj, ClassInfoHolder 
classInfoHolder);
 
+  void writeRef(MemoryBuffer buffer, Object obj, ClassInfo classInfo);
+
   void writeNonRef(MemoryBuffer buffer, Object obj);
 
   void writeNonRef(MemoryBuffer buffer, Object obj, ClassInfo classInfo);
@@ -124,6 +126,11 @@ interface SerializationBinding {
       fury.writeRef(buffer, obj, classInfoHolder);
     }
 
+    @Override
+    public void writeRef(MemoryBuffer buffer, Object obj, ClassInfo classInfo) 
{
+      fury.writeRef(buffer, obj, classInfo);
+    }
+
     @Override
     public <T> T readRef(MemoryBuffer buffer, Serializer<T> serializer) {
       return fury.readRef(buffer, serializer);
@@ -317,6 +324,11 @@ interface SerializationBinding {
       fury.xwriteRef(buffer, obj);
     }
 
+    @Override
+    public void writeRef(MemoryBuffer buffer, Object obj, ClassInfo classInfo) 
{
+      fury.xwriteRef(buffer, obj);
+    }
+
     @Override
     public <T> T readRef(MemoryBuffer buffer, Serializer<T> serializer) {
       return (T) fury.xreadRef(buffer, serializer);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to