[foreign-abi] RFR: 8253430: Improve the LibraryLookup API
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon Sep 21 14:02:54 UTC 2020
This patch implements a couple of suggestion which were made a couple of weeks ago by @BlueGoliath - here:
https://mail.openjdk.java.net/pipermail/panama-dev/2020-July/010140.html
Two ideas here:
* Change the signature of `LibraryLookup::ofPath` to actually take a `Path` (rathar than a `String`)
* Tweak `LibraryLookup::lookup` to return `Optional` (rather than throw)
Both suggestions seem to change the API for the better. The second one is probably more controversial: on the one hand
it removes the need for having exception handling logic and makes it for more composable logic. On the other hand
clients have to manually call `get` on the lookup result. But overall seems a win.
-------------
Commit messages:
- * Tweak Library::ofPath to accept Path arguments
Changes: https://git.openjdk.java.net/panama-foreign/pull/348/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=348&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8253430
Stats: 204 lines in 16 files changed: 37 ins; 64 del; 103 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/348.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/348/head:pull/348
PR: https://git.openjdk.java.net/panama-foreign/pull/348
More information about the panama-dev
mailing list