RFR: JDK-8297413: Remove easy warnings in javafx.graphics

Nir Lisker nlisker at openjdk.org
Sat Nov 26 21:14:16 UTC 2022


On Wed, 23 Nov 2022 07:26:31 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Actually, I think the new code correct, though less clear, since `(long)` is applied to `physicalWidth` before the multiplication. The fact that we had to scratch our head and discuss it highlights the point I was trying to make. I do think this is one place where reverting the code back would be best. Then it's obvious that all of the intermediate calculations are in long.
>
> The cast has precedence and Java will not downcast mid calculation and lose precision, so all examples here are correct.

`4L * physicalWidth * physicalHeight;` does not require an explicit cast, so I think it's the clearest.

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

PR: https://git.openjdk.org/jfx/pull/960


More information about the openjfx-dev mailing list