Exclude syntax info's origin from its hash code#8502
Merged
APickledWalrus merged 4 commits intodev/patchfrom Mar 27, 2026
Merged
Exclude syntax info's origin from its hash code#8502APickledWalrus merged 4 commits intodev/patchfrom
APickledWalrus merged 4 commits intodev/patchfrom
Conversation
Efnilite
approved these changes
Mar 15, 2026
src/test/java/org/skriptlang/skript/registration/SyntaxRegistryTest.java
Show resolved
Hide resolved
Efnilite
approved these changes
Mar 15, 2026
sovdeeth
approved these changes
Mar 23, 2026
APickledWalrus
approved these changes
Mar 27, 2026
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.
Problem
When registering an element without defining its origin, Skript will automatically apply an origin to it pointing to the addon that registered it. That's extremely useful but unfortunately means that the syntax info that Skript registers isn't the same as the one provided by the addon, due to the origin being included in the hash code, thus having different hashes. Which in turn means that, when the addon tries to unregister the same info later on, Skript won't be able to find and unregister it.
Solution
Exclude the origin from the hash, since it's not part of the syntax info's properties. Which also aligns with how the
equalsmethod is currently implemented. (origin is excluded)Testing Completed
Added a test case in
SyntaxRegistryTest.javafor unregistering elements with different originsSupporting Information
Completes: none
Related: none
AI assistance: none