Open
Conversation
The implementation of TypedListTag fully supports mutation with the necessary validation checks, so it's purpose isn't just iteration (anymore).
There's nothing inherently wrong with a typed but empty list, as long as it's properly serialized. Resetting a ListTag's type when it runs empty circumvents pollution checks, meaning a ListTag could (accidentally) change its type, which feels like asking for trouble :)
Git seems to generate a very unfortunate diff for this...
De-dupes validation logic. Modifying a passed in list circumvented validation. It's still possible to modify a `ListTag` using the `List`-interface via `asList`.
Querz
reviewed
Jun 1, 2023
| return ((NumberTag) tag).asByte(); | ||
| } | ||
| public Tag getTagOrNull(int index) { | ||
| if (index < value.size()) { |
Owner
There was a problem hiding this comment.
this is missing the check that index is >= 0
Contributor
Author
There was a problem hiding this comment.
I had this initially, but decided that if you're passing in a negative index something must've gone so horribly wrong somewhere that it makes more sense to fail fast. This is consistent with other libraries like guava's Iterables.get.
Contributor
Author
There was a problem hiding this comment.
Sorry I've been gone for a while, how do you feel about this now @Querz?
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.
Title says it all :)
I'd recommend reviewing this per-commit. The non-trivial ones have explanations in the message.