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] Support copy ref in JAVA #1747

Closed
chaokunyang opened this issue Jul 21, 2024 · 0 comments · Fixed by #1771
Closed

[Java] Support copy ref in JAVA #1747

chaokunyang opened this issue Jul 21, 2024 · 0 comments · Fixed by #1771
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@chaokunyang
Copy link
Collaborator

chaokunyang commented Jul 21, 2024

Is your feature request related to a problem? Please describe.

Support copy ref in JAVA.

Current implementation will throw StackOverFlowException:
image

  @Test(dataProvider = "fury")
  public void testBean(FuryBuilder builder) {
    Fury fury = builder.withMetaShare(false).withRefTracking(true).build();
    for (Object[] objects : beans()) {
      Object notCyclic = objects[0];
      Object cyclic = objects[1];
      Assert.assertEquals(notCyclic, fury.deserialize(fury.serialize(notCyclic)));
      Assert.assertEquals(cyclic, fury.deserialize(fury.serialize(cyclic)));
      Object[] arr = new Object[2];
      arr[0] = arr;
      arr[1] = cyclic;
      Assert.assertEquals(arr[1], ((Object[]) fury.deserialize(fury.serialize(arr)))[1]);
      List<Object> list = new ArrayList<>();
      list.add(list);
      list.add(cyclic);
      list.add(arr);
      fury.copy(cyclic);
    }
  }

Describe the solution you'd like

Additional context

#1679

@chaokunyang chaokunyang added the enhancement New feature or request label Jul 21, 2024
@chaokunyang chaokunyang added the good first issue Good for newcomers label Jul 21, 2024
chaokunyang added a commit that referenced this issue Jul 24, 2024
## What does this PR do?

rename copyTrackingRef to copyRef

## Related issues
#1679 
#1747


## 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.
-->
chaokunyang added a commit that referenced this issue Jul 27, 2024
## What does this PR do?

support deep ref copy

## Related issues

Closes #1747
#1679


## 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.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant