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

ListVAccessor.get() should return an unmodifiable DtList #124

Open
ojathelonius opened this issue Jun 14, 2018 · 1 comment
Open

ListVAccessor.get() should return an unmodifiable DtList #124

ojathelonius opened this issue Jun 14, 2018 · 1 comment

Comments

@ojathelonius
Copy link

Is there a point in allowing the modification of DtLists returned by the Accessor from the database ?

See example :

// after load()

final DtList<CustomObject> elements = myObject.elements().get();
final DtList<CustomObject> otherElements = otherObject.elements().get();

elements.addAll(otherElements);

In the example above, otherElements will be stacked on top of elements every time the code runs, which is probably not the desired outcome since myObject.elements().get() is expected to be pristine data.

ListVAccessor.get() could return an unmodifiable DtList instead.

@skerdudou
Copy link
Contributor

Even more dangerous if myObject is a ref element shared by all threads.
A buggy code in one place can mess up all.

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

No branches or pull requests

2 participants