On Sun, 16 Mar 2025 18:36:05 GMT, Michael Strauß <[email protected]> wrote:
>> 8350917: Allow parent nodes to provide CSS styleable properties for child
>> nodes
>
> modules/javafx.graphics/src/main/java/javafx/css/Styleable.java line 101:
>
>> 99: * only for its direct children!
>> 100: *
>> 101: * @return an immutable list of CSS meta data, never {@code null}
>
> Since we don't specify that `getCssMetaData()` should never return null, we
> should consider also not specifying it here. Alternatively, maybe we should
> add the non-null requirement to the existing `getCssMetaData()`.
That might be a good idea, as there are several places in `CssStyleHelper`
where `getCssMetaData` is assumed to be non-null already (and also a few
locations where it is assumed it can be `null`). In other words, if the
function would return `null`, FX would break currently.
For example, `recalculateRelativeSizeProperties` will do:
final List<CssMetaData<? extends Styleable, ?>> styleables =
node.getCssMetaData();
final int numStyleables = styleables.size();
Which would be an NPE.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1714#discussion_r1997723358