RFR: 8304913: Use OperatingSystem, Architecture, and Version in jlink
Jaikiran Pai
jpai at openjdk.org
Thu May 4 12:39:23 UTC 2023
On Fri, 21 Apr 2023 17:06:44 GMT, Roger Riggs <rriggs 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/internal/Platform.java line 64:
> 62: */
> 63: public boolean is64Bit() {
> 64: return (Architecture.is64bit());
Nit - the enclosing `()` aren't needed.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Platform.java line 71:
> 69: */
> 70: public static Platform runtime() {
> 71: return new Platform(OperatingSystem.current(), Architecture.current());
Should we create a single `private static final Platform`, in this class, to represent the current platform, and keep returning it instead of creating a new instance on each call?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13585#discussion_r1184952486
PR Review Comment: https://git.openjdk.org/jdk/pull/13585#discussion_r1184954303
More information about the core-libs-dev
mailing list