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

Roger Riggs rriggs at openjdk.org
Thu Mar 9 17:21:45 UTC 2023


On Thu, 9 Mar 2023 16:05:56 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java line 98:
>> 
>>> 96:     @ForceInline
>>> 97:     public static boolean isLinux() {
>>> 98:         return OperatingSystemProps.TARGET_OS_IS_LINUX;
>> 
>> Suggestion:
>> 
>>         return OperatingSystemProps.CURRENT_OS_ORDINAL == Linux.ordinal();
>> 
>> 
>> This will also simplify the template file as `TARGET_OS_IS_XXX` constants are not needed.
>> 
>> Also suggest to rename `TARGET_OS_ORDINAL` to `CURRENT_OS_ORDINAL` since it represents the current OS (vs the build target).
>
> That would not yield a compile time constant.
> The TARGET_IS_XXX values must evaluate to compile time constants as evaluated by javac.

Using the naming from the build makes it clearer that there is a dependency between the build names and those in the template.

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

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



More information about the build-dev mailing list