RFR: 8253702: BigSur java/lang/System/OsVersionTest.java: 10.16 != 11.0 [v2]

Roger Riggs rriggs at openjdk.java.net
Thu Feb 11 19:15:44 UTC 2021


On Thu, 11 Feb 2021 19:09:52 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> src/java.base/macosx/native/libjava/java_props_macosx.c line 262:
>> 
>>> 260:             // Copy out the char*
>>> 261:             osVersionCStr = strdup([nsVerStr UTF8String]);
>>> 262:         } else if (getenv("SYSTEM_VERSION_COMPAT") == NULL) {
>> 
>> If version is 10.16 and `SYSTEM_VERSION_COMPAT` is set, you will fall through to the pre-10.9 Mac OS code fallback. Just checking to see if that's what you intended.
>
> FWIW, it seems to work OK using the legacy fallback path (reports 10.16 if I set `SYSTEM_VERSION_COMPAT=1`).

The same version string is available from both APIs, reading from the SystemVersion.plist is a bit slower.
It would be clearer to move the checking of SYSTEM_VERSION_COMPAT to the first test (line:252)
so the version info does not need to be read from the files.

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

PR: https://git.openjdk.java.net/jdk/pull/2530


More information about the core-libs-dev mailing list