-
Notifications
You must be signed in to change notification settings - Fork 2
Multi weaver #25
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
base: master
Are you sure you want to change the base?
Multi weaver #25
Conversation
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.
Pull request overview
This PR adds a copy constructor to the BiFunctionClassMap class to support creating independent copies of map instances. The change enables creating a new map with all mappings from an existing map while maintaining full independence.
Changes:
- Added a copy constructor to
BiFunctionClassMapthat creates a deep copy of the map and its internalClassMapper - Added comprehensive test coverage for the new copy constructor including edge cases, independence verification, and hierarchy resolution
- Updated GitHub Actions workflow to use
actions/checkout@v6
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| SpecsUtils/src/pt/up/fe/specs/util/classmap/BiFunctionClassMap.java | Adds copy constructor with covariant return type support, including deep copying of internal map and ClassMapper |
| SpecsUtils/test/pt/up/fe/specs/util/classmap/BiFunctionClassMapTest.java | Adds 8 comprehensive test cases covering copy constructor behavior, independence, hierarchy resolution, and edge cases |
| .github/workflows/nightly.yml | Updates checkout action from v4 to v6 |
SpecsUtils/src/pt/up/fe/specs/util/classmap/BiFunctionClassMap.java
Outdated
Show resolved
Hide resolved
fbaacf7 to
543a0e1
Compare
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.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| public <ER extends R> BiFunctionClassMap(BiFunctionClassMap<T, U, ER> other) { | ||
| this.map = new HashMap<>(); | ||
| for (var keyPair : other.map.entrySet()) { | ||
| this.map.put(keyPair.getKey(), (BiFunction<T, U, R>) keyPair.getValue()); | ||
| } | ||
| this.classMapper = new ClassMapper(other.classMapper); | ||
| } |
Copilot
AI
Jan 21, 2026
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.
The copy constructor is missing Javadoc documentation. Please add documentation that explains:
- The purpose of this constructor (creating a deep copy of another BiFunctionClassMap)
- The generic type parameter ER and its constraint (ER extends R, allowing covariant copying)
- The behavior regarding independence of the copy (changes to either map don't affect the other)
- Example usage if appropriate
This would align with the documentation style of other constructors and methods in the class.
| public <ER extends R> BiFunctionClassMap(BiFunctionClassMap<T, U, ER> other) { | ||
| this.map = new HashMap<>(); | ||
| for (var keyPair : other.map.entrySet()) { | ||
| this.map.put(keyPair.getKey(), (BiFunction<T, U, R>) keyPair.getValue()); |
Copilot
AI
Jan 21, 2026
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.
The unchecked cast on line 47 should be documented with a @SuppressWarnings annotation to clarify why it's safe. The cast is necessary because of Java's generic type system limitations with wildcards, but it's safe because ER extends R, ensuring type compatibility. Consider adding @SuppressWarnings("unchecked") to the constructor method signature, similar to how it's used in the get() methods in this class (lines 71 and 87).
No description provided.