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


##########
java/fury-core/src/main/java/org/apache/fury/Fury.java:
##########
@@ -1220,6 +1239,43 @@ public Object 
deserializeJavaObjectAndClass(FuryReadableChannel channel) {
     return deserializeJavaObjectAndClass(buf);
   }
 
+  @Override
+  public <T> T copy(T obj) {
+    if (obj == null) {
+      return null;
+    }
+    copyDepth++;
+    try {
+      return (T) 
classResolver.getOrUpdateClassInfo(obj.getClass()).getSerializer().copy(obj);
+    } catch (StackOverflowError e) {

Review Comment:
   The try catch is expensive, the nested copy should not go to here. Maybe we 
should add a new copy method like `copyObject` which is used in nested copy, 
and replace all internal invoke of this `copy(T obj)` with `copyObject(T obj)`



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