[Java] ReplaceResolveSerializer circular references copy bug

Đang mở
#1,943 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@zhaommmmomo đang làm issue này rồi.

Từ ngày 13/11/2024.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug
Search before asking
  • I had searched in the issues and found no similar issues.
Version

fury 0.10.0-SNAPSHOT
https://github.com/apache/fury/pull/1925

Component(s)

Java

Minimal reproduce step
@Test
  public void test() {
    Fury fury = Fury.builder().withRefCopy(true).withLanguage(Language.JAVA).build();
    fury.registerSerializer(Tmp.class, ReplaceResolveSerializer.class);
    Tmp a = new Tmp();
    Tmp b = new Tmp();
    a.name = "a";
    a.ref = b;
    b.name = "b";
    b.ref = a;
    Tmp copy = fury.copy(a);
    assertNotSame(copy, a);
  }

  public static class Tmp implements Serializable {
    public Object ref;
    public String name;

    private Object writeReplace() {
      return ref;
    }

    private Object readResolve() {
      return ref;
    }
  }
What did you expect to see?

The copied object should not have the same address as the original object.

What did you see instead?

The copied object has the same address as the original object.
image

Anything Else?

No response

Are you willing to submit a PR?
  • I'm willing to submit a PR!
Ngôn ngữ chính
Java
Star
4.6k
Fork
470
Merge trung bình
9 giờ 28 phút
Pull request đã merge (30 ngày)
33

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/fory

Tất cả issue của apache/fory

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.