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

Collection fast cloners and non-cloned objects #30

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 3 comments
Open

Collection fast cloners and non-cloned objects #30

GoogleCodeExporter opened this issue Mar 14, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

The fast cloners for Sets and Lists should check for a null response from 
cloner.cloneInternal() before attempting to add to the collection as it's 
possible that null would be returned due to ignoredInstances or ignored classes.

The behavior for a Map is a bit more questionable-- but again would think that 
storing a null value for a key would not be the expected result. In addition, 
it's possible the key itself would not be cloned.

Original issue reported on code.google.com by jklap...@gmail.com on 22 May 2014 at 4:43

@GoogleCodeExporter
Copy link
Author

hmm, but what would happen if cloneInternal() returns null? If we don't add the 
item, the cloned list will contain less items than the original

Original comment by kostas.k...@googlemail.com on 21 Jun 2014 at 8:42

@GoogleCodeExporter
Copy link
Author

It would. But adding null is likely going to cause more issues then a different 
sized collection. If an object was set up to not be cloned and set to null- and 
since that is behavior explicitly set up I would think the cloner user would 
expect the collection to be smaller.

Original comment by jklap...@gmail.com on 21 Jun 2014 at 9:06

@GoogleCodeExporter
Copy link
Author

maybe it is worth filtering out nulls and see how it goes. Seems to me to be a 
bad practice if an instance in a list is configured to be null-ed instead of 
cloned. But if it is so, maybe it is better to filter it out.

Original comment by kostas.k...@googlemail.com on 22 Jun 2014 at 4:45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant