On Sat, 3 Aug 2024 00:14:23 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/util/Utils.java line >> 183: >> >>> 181: * <li>If the intermediate list is shallow-equal to the first >>> list passed into the method (i.e. its >>> 182: * elements are references to the same objects), the >>> existing list is returned. >>> 183: * <li>If a new list is returned, it is unmodifiable. >> >> Well, it's documented, but I'd rather see this return an unmodifiable list >> in all cases (and not one of the input lists if it was determined to be >> modifiable). Perhaps ensure this is compatible with `List.copyOf` so that >> copies are only made when needed. > > In practice, any list that is passed into this method is already > unmodifiable. This isn't a general-purpose method, it's tailored towards its > usage for `Border` and `Background` interpolation, and the optimization > scheme that is used in these classes. Alright, I get how it works now, and that there is a lot of reference equality checking going on by callers. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1522#discussion_r1703411678