mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8331671: Implement JEP 472: Prepare to Restrict the Use of JNI
Reviewed-by: jpai, prr, ihse, kcr, alanb
This commit is contained in:
parent
ce83f6af64
commit
20d8f58c92
107 changed files with 551 additions and 182 deletions
|
@ -285,14 +285,14 @@ public interface SymbolLookup {
|
|||
* @throws WrongThreadException if {@code arena} is a confined arena, and this method
|
||||
* is called from a thread {@code T}, other than the arena's owner thread
|
||||
* @throws IllegalArgumentException if {@code name} does not identify a valid library
|
||||
* @throws IllegalCallerException If the caller is in a module that does not have
|
||||
* @throws IllegalCallerException if the caller is in a module that does not have
|
||||
* native access enabled
|
||||
*/
|
||||
@CallerSensitive
|
||||
@Restricted
|
||||
static SymbolLookup libraryLookup(String name, Arena arena) {
|
||||
Reflection.ensureNativeAccess(Reflection.getCallerClass(),
|
||||
SymbolLookup.class, "libraryLookup");
|
||||
SymbolLookup.class, "libraryLookup", false);
|
||||
if (Utils.containsNullChars(name)) {
|
||||
throw new IllegalArgumentException("Cannot open library: " + name);
|
||||
}
|
||||
|
@ -319,14 +319,14 @@ public interface SymbolLookup {
|
|||
* is called from a thread {@code T}, other than the arena's owner thread
|
||||
* @throws IllegalArgumentException if {@code path} does not point to a valid library
|
||||
* in the default file system
|
||||
* @throws IllegalCallerException If the caller is in a module that does not have
|
||||
* @throws IllegalCallerException if the caller is in a module that does not have
|
||||
* native access enabled
|
||||
*/
|
||||
@CallerSensitive
|
||||
@Restricted
|
||||
static SymbolLookup libraryLookup(Path path, Arena arena) {
|
||||
Reflection.ensureNativeAccess(Reflection.getCallerClass(),
|
||||
SymbolLookup.class, "libraryLookup");
|
||||
SymbolLookup.class, "libraryLookup", false);
|
||||
if (path.getFileSystem() != FileSystems.getDefault()) {
|
||||
throw new IllegalArgumentException("Path not in default file system: " + path);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue