On Wed, 27 Oct 2021 02:51:24 GMT, Jaikiran Pai <[email protected]> wrote:
>> On, macOS 11.x, system libraries are loaded from dynamic linker cache. The
>> libraries are no longer present on the filesystem.
>> `NativeLibraries::loadLibrary` checks for the file existence before calling
>> `JVM_LoadLibrary`. Such check no longer applies on Big Sur. This
>> proposes that on macOS >= 11, it will skip the file existence check and
>> attempt to load a library for each path from java.library.path and system
>> library path.
>
> src/java.base/macosx/classes/jdk/internal/loader/ClassLoaderHelper.java line
> 44:
>
>> 42: } catch (NumberFormatException e) {}
>> 43: }
>> 44: hasDynamicLoaderCache = major >= 11;
>
> Hello Mandy,
> I'm not too familiar with MacOS versioning schemes. However, in this specific
> logic, if the `os.version` value doesn't contain a dot character, then the
> `major` is initialized to `11`, which would then evaluate this
> `hasDynamicLoaderCache` to `true`. That would mean if the `os.version` is
> (for example) `10`, then `hasDynamicLoaderCache` will be incorrectly set to
> `true` here, isn't it?
macOS product version contains 3 parts: major, minor, and patch version. But
it does not hurt to handle the case where no dot exists in the string.
int major = 11;
int i = osVersion.indexOf('.');
try {
major = Integer.parseInt(i < 0 ? osVersion : osVersion.substring(0,
i));
} catch (NumberFormatException e) {}
-------------
PR: https://git.openjdk.java.net/jdk/pull/6127