RFR: 8345261: Refactor the Dimension2D classes
Andy Goryachev
angorya at openjdk.org
Mon Dec 2 19:20:47 UTC 2024
On Fri, 29 Nov 2024 17:00:42 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
> A small refactoring of the Dimension classes.
>
> * `com.sun.javafx.geom.Dimension` was removed and its uses were replaced by `com.sun.javafx.geom.Dimension2D`.
> * `com.sun.javafx.geom.Dimension2D` became a record.
> * `javafx.geometry.Dimension2D`: fields became `final`.
>
> I'm not sure we need the implementation class at all considering we are free to use the public one.
modules/javafx.graphics/src/main/java/com/sun/glass/ui/gtk/screencast/TokenStorage.java line 372:
> 370: affectedScreenBounds
> 371: .stream()
> 372: .map(rectangle -> new Dimension2D(rectangle.width, rectangle.height))
the largest positive integer that can be stored in a float exactly is ~16M. we are fine here.
modules/javafx.graphics/src/main/java/com/sun/javafx/geom/Dimension2D.java line 29:
> 27:
> 28: /**
> 29: * A 2D dimension object that contains a width and a height.
maybe mention that this class uses `float`s?
modules/javafx.graphics/src/main/java/com/sun/javafx/geom/Dimension2D.java line 31:
> 29: * A 2D dimension object that contains a width and a height.
> 30: */
> 31: public record Dimension2D(float width, float height) {}
I wish this class was named differently to signify it's based on float...
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1653#discussion_r1866470555
PR Review Comment: https://git.openjdk.org/jfx/pull/1653#discussion_r1866467764
PR Review Comment: https://git.openjdk.org/jfx/pull/1653#discussion_r1866477629
More information about the openjfx-dev
mailing list