RFR: 8341372: BackgroundPosition, BorderImage, BorderStroke, CornerRadii should be final [v2]
Andy Goryachev
angorya at openjdk.org
Wed Oct 2 17:53:16 UTC 2024
On Wed, 2 Oct 2024 17:50:32 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> Backgrounds and borders are comprised of immutable and final types. The following types are marked with the `final` modifier:
>>
>> * Background
>> * BackgroundFill
>> * BackgroundImage
>> * BackgroundSize
>> * Border
>> * BorderWidths
>>
>> The following types are not marked with the `final` modifier:
>>
>> * BackgroundPosition
>> * BorderImage
>> * BorderStroke
>> * CornerRadii
>>
>> This is probably just an oversight, as there is no value in allowing a subsection of these types to be extended.
>
> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
>
> make fields private
Marked as reviewed by angorya (Reviewer).
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.
-------------
PR Review: https://git.openjdk.org/jfx/pull/1587#pullrequestreview-2343659046
PR Review Comment: https://git.openjdk.org/jfx/pull/1587#discussion_r1784967669
More information about the openjfx-dev
mailing list