RFR: 8303485: Replacing os.name for operating system customization

Roger Riggs rriggs at openjdk.org
Thu Mar 9 16:17:23 UTC 2023


On Wed, 8 Mar 2023 22:49:05 GMT, Raffaello Giulietti <rgiulietti 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.).

Names and branding have changed over the years. 
It may be prudent to remove the name entirely and stick to a 'generic' identification of the OS as the Enum name.

> 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?

These names need to match the names used in the build makefiles; currently is macosx.

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

PR: https://git.openjdk.org/jdk/pull/12931



More information about the build-dev mailing list