RFR: 8304913: Use OperatingSystem, Architecture, and Version in jlink

Jaikiran Pai jpai at openjdk.org
Thu May 4 12:32:19 UTC 2023


On Thu, 4 May 2023 12:27:26 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Refactor the Platform class of jlink to use jdk.internal.util OperatingSystem and Architecture instead of os.name and os.arch. 
>> They are direct replacements for the Platform enums except for UNKNOWN; its use is refactored to report errors via exceptions.
>> 
>> Neither os.name nor os.arch should be assumed to be changeable; 
>> one test case is removed because it assumes os.name can be changed on the command line.
>
> src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java line 575:
> 
>> 573:         if (Files.exists(binDir.resolve("java")) ||
>> 574:             Files.exists(binDir.resolve("java.exe"))) {
>> 575:             return new DefaultExecutableImage(root, retrieveModules(root), Platform.runtime());
> 
> Hello Roger, I couldn't find any usages of this (existing) `public static ExecutableImage getExecutableImage(Path root)` in the code. Maybe we could remove it?

If we do remove this method, the `private static Set<String> retrieveModules(Path root)` method in this same class will become unused too, so can be removed too.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13585#discussion_r1184946521


More information about the core-libs-dev mailing list