RFR: 8341372: BackgroundPosition, BorderImage, BorderStroke, CornerRadii should be final

Michael Strauß mstrauss at openjdk.org
Wed Oct 2 17:25:43 UTC 2024


On Wed, 2 Oct 2024 14:43:33 GMT, Andy Goryachev <angorya 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.
>
> modules/javafx.graphics/src/main/java/javafx/scene/layout/BackgroundPosition.java line 55:
> 
>> 53:  * @since JavaFX 8.0
>> 54:  */
>> 55: public final class BackgroundPosition implements Interpolatable<BackgroundPosition> {
> 
> should we also declare the fields `final` as well?
> horizontalSide, etc.

All fields of `BackgroundPosition` are already final. Same for `BorderImage` and `BorderStroke`.

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

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


More information about the openjfx-dev mailing list