On Mon, 15 Apr 2024 08:37:55 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> While `SymbolLookup` correctly uses an `Optional` return to denote whether a >> symbol has been found by the lookup or not (which enables composition of >> symbol lookups), many clients end up just calling `Optional::get`, or >> `Optional::orElseThrow()` on the result. >> >> This PR proposes to add a convenience method `SymbolLookup::findOrThrow` >> that will do a lookup and, if no symbol can be found, throws an >> `IllegalArgumentException` with a relevant exception message. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Fix typo > - Update after PR comments src/java.base/share/classes/java/lang/foreign/SymbolLookup.java line 154: > 152: * Returns the address of the symbol with the given name or throws > an Exception. > 153: *<p> > 154: * This is equivalent to the following code, but is more resource > efficient: Suggestion: * This is equivalent to the following code, but is more efficient: ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18474#discussion_r1565485693