RFR: 8360037: Refactor ImageReader in preparation for Valhalla support [v16]
Alan Bateman
alanb at openjdk.org
Thu Jul 31 13:45:13 UTC 2025
On Thu, 31 Jul 2025 13:00:33 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Convert non-visible markdown comments to JavaDoc for consistency.
>
> src/java.base/share/classes/jdk/internal/jimage/ImageReader.java line 203:
>
>> 201: super(imagePath, byteOrder);
>> 202: this.imageFileAttributes = Files.readAttributes(imagePath, BasicFileAttributes.class);
>> 203: this.nodes = new HashMap<>(INITIAL_NODE_CACHE_CAPACITY);
>
> The comment above the `INITIAL_NODE_CACHE_CAPACITY` suggests that we are talking about the number of `nodes` that this map would typically hold - ie. the number of entries in the map. If that's the case, then it would be better to use the newly introduced (in Java 19) `HashMap.newHashMap(int numMappings)` method here.
The jimage code is still compiled --release 8 to allow jrt-fs.jar to loaded by IDEs/tools that run on older JDK releases but target other releases. But yes, a reminder that the initial capability parameter doesn't do exactly what people expect.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26054#discussion_r2245333819
More information about the core-libs-dev
mailing list