chaokunyang commented on code in PR #1794:
URL: https://github.com/apache/fury/pull/1794#discussion_r1709714237


##########
java/fury-core/src/main/java/org/apache/fury/serializer/JdkProxySerializer.java:
##########
@@ -60,6 +60,17 @@ public void write(MemoryBuffer buffer, Object value) {
     fury.writeRef(buffer, Proxy.getInvocationHandler(value));
   }
 
+  @Override
+  public Object copy(Object value) {
+    Class<?>[] interfaces = value.getClass().getInterfaces();
+    InvocationHandler invocationHandler = Proxy.getInvocationHandler(value);
+    Preconditions.checkNotNull(interfaces);
+    Preconditions.checkNotNull(invocationHandler);
+    Object proxy = Proxy.newProxyInstance(fury.getClassLoader(), interfaces, 
STUB_HANDLER);
+    Platform.putObject(proxy, PROXY_HANDLER_FIELD_OFFSET, invocationHandler);

Review Comment:
   ```suggestion
       Object proxy = Proxy.newProxyInstance(fury.getClassLoader(), interfaces, 
STUB_HANDLER);
       fury.reference(value, proxy);
       Platform.putObject(proxy, PROXY_HANDLER_FIELD_OFFSET, 
          fury.copyObject(invocationHandler));
   ```



-- 
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: commits-unsubscr...@fury.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org
For additional commands, e-mail: commits-h...@fury.apache.org

Reply via email to