RFR: 8303485: Replacing os.name for operating system customization
Raffaello Giulietti
rgiulietti at openjdk.org
Wed Mar 8 22:58:17 UTC 2023
On Wed, 8 Mar 2023 19:15:16 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Improvements to support OS specific customization for JDK internal use:
> - To select values and code; allowing elimination of unused code and values
> - Optionally evaluated by build processes, compilation, or archiving (i.e. CDS)
> - Simple API to replace adhoc comparisons with `os.name`
> - Clear and consistent use across build, runtime, and JDK modules
>
> The PR includes updates within java.base to use the new API.
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java line 74:
> 72: * The Mac OS X Operating system.
> 73: */
> 74: Mac("Mac OS X"),
The current spelling used by Apple is "macOS", probably to align to other Apple systems (iOS, iPadOS, etc.).
src/java.base/share/classes/jdk/internal/misc/OperatingSystemProps.java.template line 34:
> 32: // The values must match the ordinals of the respective enum
> 33: private static final int TARGET_OS_linux = 0;
> 34: private static final int TARGET_OS_macosx = 1;
`TARGET_OS_macos` maybe?
src/java.base/share/classes/jdk/internal/misc/OperatingSystemProps.java.template line 43:
> 41: // Precomputed booleans for each Operating System
> 42: static final boolean TARGET_OS_IS_LINUX = TARGET_OS_@@OPENJDK_TARGET_OS@@ == TARGET_OS_linux;
> 43: static final boolean TARGET_OS_IS_MACOSX = TARGET_OS_@@OPENJDK_TARGET_OS@@ == TARGET_OS_macosx;
`TARGET_OS_IS_MACOS` to be consistent with the suggestions.
-------------
PR: https://git.openjdk.org/jdk/pull/12931
More information about the build-dev
mailing list