[Rev 01] RFR: 8208761: Update constant collections to use the new immutable collections
kcr at openjdk.java.net
Fri Feb 21 00:17:44 UTC 2020
On Fri, 21 Feb 2020 00:12:53 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> The pull request has been updated with 1 additional commit.
> I took a preliminary look, and only have one high-level concern that might end up not being a problem, but will need to be checked. The docs for an Unmodifiable Set, List, or Map state that they are "value-based", meaning that the identity of the stored objects cannot be relied upon. I think `Color` is the only place where that could even possibly be an issue, since both the Color constants and the method to get a Color by looking up a string in a Map are public. In the event that `Map.get` returned an instance that was `.equals` but not `==`, an application might see a difference in behavior. I'm not sure that actually applies to the values in a `Map.entry` passed into `Map.of`, though.
> I also left one minor comment inline.
> The docs for an Unmodifiable Set, List, or Map state that they are "value-based", meaning that the identity of the stored objects cannot be relied upon.
I misread this. It is the Set, List or Map itself that is "value-based" not the entries contained therein. So there is no problem that I can see.
I will do more testing and a more careful review later.
More information about the openjfx-dev