mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8228336: Refactor native library loading implementation
Reviewed-by: alanb, dholmes
This commit is contained in:
parent
36fac8c332
commit
d5d6dc0caa
16 changed files with 817 additions and 617 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, Azul Systems, Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
|
@ -36,6 +36,7 @@ import java.util.Optional;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
import jdk.internal.loader.NativeLibrary;
|
||||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
|
||||
|
@ -738,11 +739,12 @@ public class Runtime {
|
|||
if (security != null) {
|
||||
security.checkLink(filename);
|
||||
}
|
||||
if (!(new File(filename).isAbsolute())) {
|
||||
File file = new File(filename);
|
||||
if (!file.isAbsolute()) {
|
||||
throw new UnsatisfiedLinkError(
|
||||
"Expecting an absolute path of the library: " + filename);
|
||||
}
|
||||
ClassLoader.loadLibrary(fromClass, filename, true);
|
||||
ClassLoader.loadLibrary(fromClass, file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -804,7 +806,7 @@ public class Runtime {
|
|||
throw new UnsatisfiedLinkError(
|
||||
"Directory separator should not appear in library name: " + libname);
|
||||
}
|
||||
ClassLoader.loadLibrary(fromClass, libname, false);
|
||||
ClassLoader.loadLibrary(fromClass, libname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue