Clarify CIP edge case behavior and add type safety guard#7363
Merged
APickledWalrus merged 3 commits intoJan 15, 2025
Conversation
Also improves ChangerUtils#acceptsChange slightly.
Moderocky
reviewed
Jan 2, 2025
| abstract class ChangerUtils { | ||
|
|
||
| public static <T> void change(Changer<T> changer, Object[] what, Object @Nullable [] delta, ChangeMode mode) { | ||
| public static <T> void change(@NotNull Changer<T> changer, Object[] what, Object @Nullable [] delta, ChangeMode mode) { |
Member
There was a problem hiding this comment.
What is the contract for what[]?
Member
Author
There was a problem hiding this comment.
idk i just clicked the intellij button to add notnull
I presume it's a notnull array with notnull values though
Moderocky
approved these changes
Jan 15, 2025
APickledWalrus
approved these changes
Jan 15, 2025
Member
APickledWalrus
left a comment
There was a problem hiding this comment.
Looks good. Is this still Internal API?
Member
Author
|
It should be safe for external use now but I would like to keep it internal a little longer, since I'm not 100% sure the design is flexible enough as is |
erenkarakal
pushed a commit
to erenkarakal/Skript
that referenced
this pull request
Nov 26, 2025
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.
Description
Adds checks to Expression#changeInPlace() to guarantee that no invalid types will be passed to #change().
Improves the docs to clarify what happens in edge cases, and legitimizes the behavior of removing values if null is returned.
Also changes ChangerUtils#acceptsChange slightly by pre-fetching component types and spinning out the class comparisons to a separate method so changeInPlace can take advantage of the same code.
Target Minecraft Versions: any
Requirements: none
Related Issues: none