RFR: 8337683: Fix -Wconversion problem with arrayOop.hpp [v5]

Coleen Phillimore coleenp at openjdk.org
Thu Aug 8 11:10:32 UTC 2024


On Thu, 8 Aug 2024 05:11:41 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   See if GHA compilers like this.
>
> src/hotspot/share/oops/arrayOop.hpp line 74:
> 
>> 72: #ifdef ASSERT
>> 73:     // make sure it isn't called before UseCompressedOops is initialized.
>> 74:     static int arrayoopdesc_hs = 0;
> 
> Why not just do a `checked_cast<int>` on the return statement? (or even a range assert and a static cast?)

Because restricting the types is better than checked_cast.  The return type of length_offset_in_bytes() is int.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20431#discussion_r1709236293


More information about the hotspot-dev mailing list