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

Nir Lisker nlisker at openjdk.org
Wed Nov 29 02:47:18 UTC 2023


On Tue, 28 Nov 2023 23:34:30 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, ?>> combine(
>> + 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:
> 
>   review comments

I'm unconvinced that this is the way to solve the issue it describes in its doc. The problem is that each control wants to add its own css metadata to that of its parent (recursively), and that the list is immutable (or unmodifiable). The solution offered is a helper method for the general problem of creating a new immutable list from an existing one plus other elements (I agree with John that 
it's another copy of this kind of method, which would probably mean it's a good candidate for the JDK).

What each class brings with itself is a list of its own metadata properties. That's all it should declare. This list should automatically be added to the one of its parent, recursively, forming the final list. This part shouldn't be done by users as it's just another place to make a mistake in.

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

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


More information about the openjfx-dev mailing list