Repository navigation
fix: addProvider threw UnsupportedOperationException on the provider register events - #94
Merged
Phoenix-Ra merged 3 commits intoOct 14, 2026
Conversation
The four "Register...VREvent" classes in visor-api/src/main/java/org/vmstudio/visor/api/client/events/provider/ kept the list passed into their constructors as just a List. XrInputHandler passes List.of(...), an immutable List, into those constructors, so calling providers.add(...) in the addProvider methods would throw UnsupportedOperationException and the event bus would log it but swallow it. The fix done here is to copy the list into an ArrayList in each constructor, but a deeper fix could be to change the private final List<XRBodyHapticsProvider> providers; to ArrayList, but that would technically change the API surface so I opted not to.
…an ArrayList This just increases the robustness of the change, enforcing that any future methods that may be created, especially accessors, cannot possibly return or access or especially set the <code>providers</code> member to an immutable <code>List</code> implementation.
LPlusBonk
commented
Oct 14, 2026
LPlusBonk
left a comment
Contributor
Author
There was a problem hiding this comment.
Looks good, looks like what I wrote 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The four "Register...VREvent" classes in
visor-api/src/main/java/org/vmstudio/visor/api/client/events/provider/ kept the list passed into their constructors as just a List. XrInputHandler passes List.of(...), an immutable List, into those constructors, so calling providers.add(...) in the addProvider methods would throw UnsupportedOperationException and the event bus would log it but swallow it. The fix done here is to copy the list into an ArrayList in each constructor, but a deeper fix could be to change the private final List providers; to ArrayList, but that would technically change the API surface so I opted not to.