RFR: 8345261: Refactor the Dimension2D classes
Michael Strauß
mstrauss at openjdk.org
Mon Jan 27 18:49:52 UTC 2025
On Mon, 2 Dec 2024 14:34:08 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:
>> Thanks @azvegint. If the `int`-based dimensions are coupled with `com.sun.javafx.geom.Rectangle` (and from the code, that's the only place they are used at), would you object to making `Dimension` an inner class of `Rectangle`? The `float`-based dimensions are used in other 2D shapes, so are more general purpose.
>
>> would you object to making Dimension an inner class of Rectangle?
>
> I am fine with it.
> Thanks @azvegint. If the `int`-based dimensions are coupled with `com.sun.javafx.geom.Rectangle` (and from the code, that's the only place they are used at), would you object to making `Dimension` an inner class of `Rectangle`? The `float`-based dimensions are used in other 2D shapes, so are more general purpose.
In my opinion, inner classes are justified when the implementations are coupled, or when one thing only makes sense in the context of another thing. That doesn't seem to be the case here: `Dimension` is neither used in `Rectangle`, nor are their implementations coupled.
What this suggests to me is that either `Dimension` should remain its own top-level class, or if it is not useful there, be moved to where it _is_ used instead.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1653#issuecomment-2616623029
More information about the openjfx-dev
mailing list