Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] ReplaceResolveSerializer circular references copy bug #1943

Open
2 tasks done
zhaommmmomo opened this issue Nov 13, 2024 · 0 comments
Open
2 tasks done

[Java] ReplaceResolveSerializer circular references copy bug #1943

zhaommmmomo opened this issue Nov 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@zhaommmmomo
Copy link
Member

Search before asking

  • I had searched in the issues and found no similar issues.

Version

fury 0.10.0-SNAPSHOT
#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!
@zhaommmmomo zhaommmmomo added the bug Something isn't working label Nov 13, 2024
@zhaommmmomo zhaommmmomo self-assigned this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant