RFR: 8320796: CssMetaData.combine() [v4]

Michael Strauß mstrauss at openjdk.org
Tue Nov 28 00:58:15 UTC 2023


On Tue, 28 Nov 2023 00:51:36 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Provides a public utility method for use by the skins (core and custom) to simplify initialization of styleable properties.
>> 
>> 
>> + /**
>> + * Utility method which combines CssMetaData items in one unmodifiable list with the size equal to the number
>> + * of items it holds (i.e. with no unnecessary overhead).
>> + *
>> + * @param list the css metadata items, usually from the parent, not nullable
>> + * @param items the additional items
>> + * @return the unmodifiable list containing all of the items
>> + *
>> + * @since 22
>> + */
>> + public static List<CssMetaData<? extends Styleable, ?>> initStyleables(
>> + List<CssMetaData<? extends Styleable, ?>> list,
>> + CssMetaData<? extends Styleable, ?>... items)
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   combine

We should also consider changing the specification of `Node.getClassCssMetaData`. It currently says:

    /**
     * Gets the {@code CssMetaData} associated with this class, which may include the
     * {@code CssMetaData} of its superclasses.
     */


That's strange. A subclass cannot elect to forgo its inherited properties; yet the specification allows it to pretend it doesn't have metadata for its inherited properties. This should be changed in the following ways:
1. A derived class **must** include the metadata of its base class.
2. The inherited metadata **must** come before the new metadata in the list.

The specification should also point developers to the new `CssMetaData.combine` API.

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

PR Comment: https://git.openjdk.org/jfx/pull/1296#issuecomment-1828889945


More information about the openjfx-dev mailing list