Add helper methods to CustomValue and its implementations#338
Open
BoogieMonster1O1 wants to merge 8 commits intoFabricMC:masterfrom
Open
Add helper methods to CustomValue and its implementations#338BoogieMonster1O1 wants to merge 8 commits intoFabricMC:masterfrom
BoogieMonster1O1 wants to merge 8 commits intoFabricMC:masterfrom
Conversation
i509VCB
reviewed
Nov 25, 2020
i509VCB
reviewed
Nov 25, 2020
i509VCB
reviewed
Nov 25, 2020
CoolMineman
suggested changes
Nov 29, 2020
i509VCB
approved these changes
Dec 4, 2020
Contributor
|
The custom value's status as not being value-based should be a bug. @sfPlayer1 What's your view on this whole thing? Will you include the new utilities besides fixing the value-based nature of these classes? |
Contributor
|
@sfPlayer1 Even though the addition of stream methods are actually optional (as they can always stream an iterable), I wonder if we want to treat our custom values as data classes (as opposed to identity objects as they are right now) |
Contributor
|
Not sure, it's really just a simple way to expose the data from the mod jsons. Implementing toString has some benefits in the debugger, but uses that depend on equals/hashCode having specific semantics are unclear. |
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.
CustomValue's implementations do not implementequalsorhashCode. This causes issues when storing them in lists and maps, where it is impossible to removeCustomValues from a list, or get the value associated with aCustomValuekey from a map.This also affects any
DynamicOpsrelying onCustomValues asFieldDecoders get returnednullwhen reading a CustomValue keyed map.This makes
CustomValue's implementations implementequals,hashCodeandtoString.This also adds a
streammethod to CvObject and CvArray, and akeySetmethod toCvObjectfor convenience.