RFR: JDK-8322964 Optimize performance of CSS selector matching [v5]

John Hendrikx jhendrikx at openjdk.org
Sat Mar 9 05:29:00 UTC 2024


On Fri, 8 Mar 2024 23:14:12 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Optimize performance of OpenAddressed Set just in case it is ever used
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/css/FixedCapacitySet.java line 135:
> 
>> 133:     protected final void ensureNotFrozen() {
>> 134:         if (frozen) {
>> 135:             throw new UnsupportedOperationException();
> 
> should we explain why?  "the set is frozen" or something like that.

I'm not against adding an explanation, but it's not needed as this is part of the `Set` contract (sets that can't be modified are specified to throw `UnsupportedOperationException`), for example for `add` in `Set`:

     * @throws UnsupportedOperationException if the {@code add} operation
     *         is not supported by this set

The concept of "freezing" the set is not visible to any users, it's just there to avoid having to make a final copy of the set. It's modifiable by the code that created it, but if they freeze it before exposing it to the outside world, then for all intents and purposes it is a read only set for anyone else.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1316#discussion_r1518482571


More information about the openjfx-dev mailing list