RFR: 8345261: Refactor the Dimension2D classes

Alexander Zvegintsev azvegint at openjdk.org
Mon Dec 2 02:22:45 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.

These 3 classes are all different from each other. They use different types of variables to store data (`double`, `float`, `int`).

We have `com.sun.javafx.geom.Rectangle` which uses `int`, and the `com.sun.javafx.geom.Dimension` was specifically introduced as its pair which also uses `int`.
(just as we have a pair of `javafx.geometry.Rectangle2D` and `javafx.geometry.Dimension2D.java`).

Switching from `int` to `float` may have some side effects on stream processing due to the imprecise comparison.

So I would prefer to keep the `com.sun.javafx.geom.Dimension`.

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

PR Comment: https://git.openjdk.org/jfx/pull/1653#issuecomment-2510424626


More information about the openjfx-dev mailing list