[foreign-memaccess+abi] RFR: 8314592: Add shortcut to SymbolLookup::find
Jorn Vernee
jvernee at openjdk.org
Fri Aug 18 17:16:48 UTC 2023
On Fri, 18 Aug 2023 17:05:46 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch adds a default method in `SymbolLookup`, namely `SymbolLookup::get`. Its implementation is very simple: it calls `SymbolLookup::find` and then `Optional::get` on the result. This allows to simplify many clients that end up calling `Optional::get` or `Optional::orElseThrow` after a symbol lookup, but still retains the compositional advantage of the optional-returning lookup primitive.
This looks like a good move, but I'm not super sure about the name `get`. It seems very close to `find` to me. I'd prefer something like `findOrThrow`.
-------------
PR Review: https://git.openjdk.org/panama-foreign/pull/871#pullrequestreview-1584932164
More information about the panama-dev
mailing list