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

fix(java): child container deep copy #1911

Merged
merged 4 commits into from
Oct 26, 2024

Conversation

zhaommmmomo
Copy link
Member

@zhaommmmomo zhaommmmomo commented Oct 26, 2024

What does this PR do?

fix child container bug

Related issues

#1855

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

public static InternalFieldInfo[] buildFieldsInfo(Fury fury, List<Field> fields) {
List<Descriptor> descriptors = new ArrayList<>();
for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transient fields should be filtered too

public Collection newCollection(Collection originCollection) {
Collection newCollection = super.newCollection(originCollection);
if (fieldInfos == null) {
List<Field> fields = ReflectionUtils.getFieldsWithoutSuperClasses(type, superClasses);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just fury.getClassResolver().getAllDescriptorsMap(beanClass, false).values(); or org.apache.fury.reflect.ReflectionUtils#getFields instead

Copy link
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chaokunyang chaokunyang merged commit b222660 into apache:main Oct 26, 2024
37 checks passed
@zhaommmmomo zhaommmmomo deleted the fix/child_container_deep_copy branch November 4, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants