-
Notifications
You must be signed in to change notification settings - Fork 31
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
Specialized collections with package remapping #231
Conversation
2. Remapping Fastutil package to lincheck package using gradle shadow plugin
List<ActorGenerator> actorGenerators = new ArrayList<>(); | ||
List<Method> validationFunctions = new ArrayList<>(); | ||
List<Method> stateRepresentations = new ArrayList<>(); | ||
Map<String, OperationGroup> groupConfigs = new Object2ObjectOpenHashMap<>(); |
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.
Just a random suggestion.
Maybe add type-aliases like LincheckHashMap
and factory functions like lincheckListOf()
and use them everywhere?
I think such solution has several benefits:
- The underlying collection implementations can be changed quite easily by changing type-aliases.
- We would hide collections' implementation details in one place.
- The name
Object2ObjectOpenHashMap
is quire verbose compared to something likeLincheckHashMap
.
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.
Oh, I see you did something similar in CollectionUtils.kt
, but I guess there is no way to use type-aliases from Java : (
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.
Anyway, what about using LincheckMutableHashMap
naming scheme instead of MutableObjectToObjectMap
?
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 agree with you, and due to this limitation on type aliases in Java, the solution with factory-like top-level functions as lincheckListOf()
looks pretty convenient, especially taking into account your arguments above. @ndkoval Do you still think it is redundant?
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 also like the flexibility it brings.
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.
Please put this discussion as a comment in the code.
src/jvm/main/org/jetbrains/kotlinx/lincheck/CollectionsUtils.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/CollectionsUtils.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/CollectionsUtils.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/CollectionsUtils.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/CollectionsUtils.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
With the current lazy transformation approach for model checking, we can safely keep using the standard collections. Therefore, I'm closing the PR. Thanks @avpotapov00 for investigating potential performance improvements! |
Fastutil
package toLincheck
package using Gradle shadow plugin