Skip to content

Commit fe80721

Browse files
Yoshiki SatoMandy Chung
Yoshiki Sato
authored and
Mandy Chung
committedJun 15, 2022
8287917: System.loadLibrary does not work on Big Sur if JDK is built with macOS SDK 10.15 and earlier
Reviewed-by: mchung
1 parent bbaeacb commit fe80721

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
 

‎src/java.base/macosx/classes/jdk/internal/loader/ClassLoaderHelper.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,8 @@ class ClassLoaderHelper {
3939
try {
4040
major = Integer.parseInt(i < 0 ? osVersion : osVersion.substring(0, i));
4141
} catch (NumberFormatException e) {}
42-
hasDynamicLoaderCache = major >= 11;
42+
// SDK 10.15 and earlier always reports 10.16 instead of 11.x.x
43+
hasDynamicLoaderCache = major >= 11 || osVersion.equals("10.16");
4344
}
4445

4546
private ClassLoaderHelper() {}

‎test/jdk/java/lang/RuntimeTests/loadLibrary/exeLibraryCache/LibraryFromCache.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
4242

4343
public class LibraryFromCache {
4444
public static void main(String[] args) throws IOException {
45+
System.out.println("os.version = " + System.getProperty("os.version"));
46+
4547
String libname = args[0];
4648
if (!systemHasLibrary(libname)) {
4749
System.out.println("Test skipped. Library " + libname + " not found");

0 commit comments

Comments
 (0)
Please sign in to comment.