On Tue, 22 Nov 2022 22:16:46 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> rotationStartTime is a double.  the type cast is really unnecessary
>
> But you don't know that without looking. Really, though, if I were going to 
> make a readability argument, it's the divisor that should be a double 
> constant, since then there is no question that the division is happen in 
> double.
> 
> I don't care too much in this case. I was just making a general point.

You are correct that with these kind of changes you can't see if it is correct 
just from looking at the diff. Variables would need to be named more 
explicitly, or explicit casts would need to be added to repeat the type 
information. If the goal is to make it clear in the diff, then many places 
would benefit from explicit casts (probably in more places than where they were 
removed).  I think the general trend is to avoid explicit casts, but I could be 
wrong.

I can revert these changes and we can disable the warning.

Specifically about this code, `rotationStartTime` probably should not have been 
a `double` depending on what is stored in it (checking: its source is 
`System.nanoTime()`) as the conversion from `long` to `double` will lose 
precision in the area where it really counts as it wants to see the difference 
of the current and last value, so in this case the warning may have exposed a 
(precision) bug.

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

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

Reply via email to