RFR: 8321159: SymbolLookup.libraryLookup(Path, Arena) Assumes default Filesystem
Alan Bateman
alanb at openjdk.org
Mon Dec 4 07:47:37 UTC 2023
On Mon, 4 Dec 2023 07:29:37 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes to reject paths provided to the `SymbolLookup.libraryLookup(Path path, Arena arena)` method if a path is not in the default file system.
src/java.base/share/classes/java/lang/foreign/SymbolLookup.java line 297:
> 295: Reflection.ensureNativeAccess(Reflection.getCallerClass(),
> 296: SymbolLookup.class, "libraryLookup");
> 297: if (!path.getFileSystem().equals(FileSystems.getDefault())) {
This trusts the custom provider's equals implementation, which might be okay but you can use == here instead.
I think I would probably expand the text of the existing IAE description to say that IAE is thrown if the path is not associated with the default file system or not a path to a valid library.
It's a new testable assertion so I assume we should add a new test and track the spec change with a CSR.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16944#discussion_r1413475612
More information about the core-libs-dev
mailing list