RFR: 8092102: Labeled: truncated property [v9]

Andy Goryachev angorya at openjdk.org
Thu May 2 22:17:03 UTC 2024


On Thu, 2 May 2024 18:34:04 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java line 114:
>> 
>>> 112:      * by itself looks rather weird.
>>> 113:      */
>>> 114:     private static boolean useActualContentWidth;
>> 
>> Even given your comment about why it's safe to use a global variable, wouldn't it be cleaner to make it an instance variable? I suppose it might be OK to keep it global, but only if you can show that there are no issues with reentrancy.
>
> re-entrancy should not be an issue: the flag is used in the context of a single method which is always being called from an fx application thread.
> 
> I do not want to increase the memory footprint by making it an instance variable.

on second thought, you are right.  we cannot guarantee that someone won't stick a TableView as a graphic into another TableView cell.

Switched to use an ephemeral entry in `Node.getProperties()`, same as `Properties.DEFER_TO_PARENT_PREF_WIDTH`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1389#discussion_r1588476651


More information about the openjfx-dev mailing list