RFR: 8341372: BackgroundPosition, BorderImage, BorderStroke, CornerRadii should be final [v2]

John Hendrikx jhendrikx at openjdk.org
Mon Oct 7 15:10:44 UTC 2024


On Wed, 2 Oct 2024 17:49:28 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   make fields private
>
> modules/javafx.graphics/src/main/java/javafx/scene/layout/Background.java line 316:
> 
>> 314:             final boolean b = fill.getRadii().hasPercentBasedRadii;
>> 315:             hasPercentFillRadii |= b;
>> 316:             if (fill.getFill().isOpaque()) {
> 
> it was probably ok to leave some fields as package protected: I don't actually know if the compiler replaces the getFill() function call with direct access to the field.
> 
> on the other hand, a public API is always a better choice.

Once the code is sufficiently often called, it will be optimized and subsequently inline the call. It then becomes equivalent to a direct field access.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1587#discussion_r1790398800


More information about the openjfx-dev mailing list