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

John Hendrikx jhendrikx at openjdk.org
Mon Dec 5 21:43:05 UTC 2022


On Mon, 5 Dec 2022 20:11:53 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix indentations and merge short lines
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/font/PrismFontFile.java line 586:
> 
>> 584:                 ascent = -(float)hhea.getShort(4);
>> 585:                 descent = -(float)hhea.getShort(6);
>> 586:                 linegap = hhea.getShort(8);
> 
> interesting: why not on the previous 2 lines?  isn't
> 
> `-(float)shortValue == (float)(-shortValue)` ?

Almost, but not quite.  If the `short` is -32768 than negating it would still be -32768.

If you write it the other way around though, it might get promoted to `int` first anyway, and the point is moot, I would have to test to make sure.

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

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


More information about the openjfx-dev mailing list