RFR: 8301302: Platform preferences API [v5]

Andy Goryachev angorya at openjdk.org
Tue Sep 5 23:26:47 UTC 2023


On Tue, 5 Sep 2023 22:51:28 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/Application.java line 762:
>> 
>>> 760:      */
>>> 761:     public Map<String, Object> getPlatformPreferences() {
>>> 762:         return Map.of();
>> 
>> Should javadoc explicitly proclaim that the map is immutable?
>
> No. This map is only used by `QuantumToolkit` to initialize the preferences. The implementation should not keep this map around, and an immutability guarantee might be seen as an invitation to do so.

would it make sense to add this explanation to javadoc, even though it's not a public API?

>> modules/javafx.graphics/src/main/java/com/sun/javafx/application/preferences/ChangedValue.java line 47:
>> 
>>> 45:      * @return a mapping of keys to changed values
>>> 46:      */
>>> 47:     public static Map<String, ChangedValue> getEffectiveChanges(Map<String, Object> old, Map<String, Object> current) {
>> 
>> this class does not handle addition of keys in `current` - should we explain this fact in this method and/or the class javadoc?
>
> It doesn't handle _removals_ of keys in `current`, which is explained in the method documentation:
> 
> "Returns a map that contains the _new or changed_ mappings of _current_ compared to _old_.
> A value has changed if _Objects#equals_ or _Arrays#equals_ returns _false_ when invoked with the old and new value."
> 
> If you think this is not clear enough, I can try to improve the wording.

is it actually possible to have keys removed at runtime?

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1316507700
PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1316509976


More information about the openjfx-dev mailing list