RFR: JDK-8297332: Remove easy warnings in base

Kevin Rushforth kcr at openjdk.org
Mon Nov 21 19:34:26 UTC 2022


On Mon, 21 Nov 2022 19:11:16 GMT, Andy Goryachev <angorya at 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
>
> modules/javafx.base/src/test/java/test/util/memory/JMemoryBuddy.java line 123:
> 
>> 121: 
>> 122:         if (weakReference.get() == null && counter < steps / 3) {
>> 123:             int percentageUsed = (steps - counter) / steps * 100;
> 
> I suspect this will not produce a desired result.
> Perhaps it should be 
> (int)(100.0 * (steps - counter) / steps);

Removing the `(int)` cast is a behavior-neutral change. What you are pointing out does look a bug, but it is unrelated to this cleanup, so should be filed and fixed separately.

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

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


More information about the openjfx-dev mailing list