Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
refactor(model): Stop implementing Comparable with DependencyReference #8697
base: main
Are you sure you want to change the base?
refactor(model): Stop implementing Comparable with DependencyReference #8697
Changes from all commits
3f2a0eb
87fd707
9ece42c
5d8f9d9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit message: Could you please add a permalink to the exact test case? I'm having trouble finding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also re-written the commit message as the thing with the
copy()
was not exactly right.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes me worry. The class comment says "This is by intention no data class. Equality is tested via references and not via the values contained." If you now have a generated
equals()
implementation that checks all properties, you can get very expensive traversals over whole graphs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, the tests which started failing when stopping to implement
Comparable
, could it be that they asserted a bit too much? (e.g. is there maybe a fix for this possible in test code?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another alternative could be to hold these dependency references always in lists, not sets, to avoid the
equals()
calls in the first place.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equals()
is called when constructing the dependency graph to match subtrees. This was the reason why this class was not a data class. I am pretty sure that this change will blow up for bigger graphs. Did you test this with a larger project?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the original motivation for this
compareTo()
implementation was... like, was the implementation more or less arbitrary, just to be able to use the class in sorted sets, or was there more to it, like and intention to sort by indices in some representation?Maybe @oheger-bosch can chime in here to confirm that this change (by now, with the preceding changes) is uncritical?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a while... But as far as I remember, the purpose of the
compareTo()
implementation was to have a more deterministic order in dependency graphs. During tests, it popped up that the order in which items were added to a graph builder had an impact on the resulting graphs. They were isomorphic, but not identical. By defining an ordering, the effect could be reduced, but not fully eliminated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you remember in what way this could be problematic? Was it non-deterministic without implementing
compareTo()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100% sure, but I think for a given order in which the graph builder was called, the results were the same.