On Tue, 22 Nov 2022 18:39:43 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

> - Remove unsupported/unnecessary SuppressWarning annotations
> - Remove reduntant type specifications (use diamond operator)
> - Remove unused or duplicate imports
> - Remove unnecessary casts (type is already correct type or can be autoboxed)
> - Remove unnecessary semi-colons (at end of class definitions, or just 
> repeated ones)
> - Remove redundant super interfaces (interface that is already inherited)
> - Remove unused type parameters
> - Remove declared checked exceptions that are never thrown
> - Add missing `@Override` annotations

I don't see a problem with removal of the unnecessary casts for numbers.

* It makes the code less cluttered.
* If only necessary casts are left, it draws the attention of the reader to a 
valuable operation, like rounding with an `int` cast.
* As John pointed out, if the definition of the types change, it stops being 
unnecessary and can hide precision loss.
* If I'm at the point where I need to reason about precision of a specific 
calculation, I can just hover my mouse over the variable and see its type. When 
just reading the code to understand what it does, the precision/exact types are 
not important.

In any case, unnecessary casts for non-numeric types should still be removed 
since the whole precision argument is irrelevant, so I don't think that the 
warning should be disabled.

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

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

Reply via email to