RFR: 8289389: Fix warnings: type should also implement hashCode() since it overrides Object.equals() [v2]

John Hendrikx jhendrikx at openjdk.org
Mon Jul 11 18:59:51 UTC 2022


On Mon, 11 Jul 2022 15:19:30 GMT, Andy Goryachev <duke at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/css/CalculatedValue.java line 101:
>> 
>>> 99:         }
>>> 100:         return h;
>>> 101:     }
>> 
>> Just an example, but wouldn't: `Objects.hash(relative, origin, value)` here work just as well?
>
> @hjohn: yes, but at a price: Object.hash(Object ...) incurs overhead by creating a temporary Object[] + boxing of a Boolean.

Ah, I didn't realize you checked how this is optimized by the JIT.

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

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


More information about the openjfx-dev mailing list