You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[native_assets_cli] Prevent EncodedAsset and Metadata hashcode changing (#2131)
Closes: #2045
We have two types of classes in the semantic API:
1. Pure views on top of a JSON.
These classes are mirrored by a builder class.
Objects from these classes cannot be passed from input to output in hooks.
These classes do not override `hashCode` and `operator ==`.
Examples: `CodeConfig`, `BuildInput`.
2. Data classes that eagerly copy all fields out of the JSON.
These classes have a public constructor with it's constituent fields.
Objects from these classes may be passed from input to output in hooks.
These classes do override `hashCode` and `operator ==`.
Examples: `CodeAsset`, `Architecture`, `OS`, `DataAsset`.
This changes `Metadata` and `EncodedAsset` to follow pattern 2 fully:
* All data is copied on construction.
* The map accessors do not allow modification.
This means the `hashCode` and `operator ==` are now correct.
We could consider changing `Metadata` and `EncodedAsset` to pattern 1, but I didn't want to refactor that code in this PR. For more details:
* #2045
0 commit comments