Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8287917: System.loadLibrary does not work on Big Sur if JDK is built …
…with macOS SDK 10.15 and earlier

Reviewed-by: clanger
Backport-of: fe807217a79753f84c00432e7451c17baa6645c5
  • Loading branch information
Jonathan Dowland committed Sep 7, 2022
1 parent c249ca9 commit 9767c4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/java.base/macosx/classes/java/lang/ClassLoaderHelper.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -38,7 +38,8 @@ class ClassLoaderHelper {
try {
major = Integer.parseInt(i < 0 ? osVersion : osVersion.substring(0, i));
} catch (NumberFormatException e) {}
hasDynamicLoaderCache = major >= 11;
// SDK 10.15 and earlier always reports 10.16 instead of 11.x.x
hasDynamicLoaderCache = major >= 11 || osVersion.equals("10.16");
}

private ClassLoaderHelper() {}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -42,6 +42,8 @@

public class LibraryFromCache {
public static void main(String[] args) throws IOException {
System.out.println("os.version = " + System.getProperty("os.version"));

String libname = args[0];
if (!systemHasLibrary(libname)) {
System.out.println("Test skipped. Library " + libname + " not found");
Expand Down

1 comment on commit 9767c4c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.