RFR: 8314592: Add shortcut to SymbolLookup::find [v4]
Jorn Vernee
jvernee at openjdk.org
Tue Apr 16 14:14:03 UTC 2024
On Mon, 15 Apr 2024 14:02:56 GMT, Per Minborg <pminborg at 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 one additional commit since the last revision:
>
> Update src/java.base/share/classes/java/lang/foreign/SymbolLookup.java
>
> Co-authored-by: Maurizio Cimadamore <54672762+mcimadamore at users.noreply.github.com>
src/java.base/share/classes/java/lang/foreign/package-info.java line 114:
> 112: *
> 113: * Here, we obtain a {@linkplain java.lang.foreign.Linker#nativeLinker() native linker}
> 114: * and we use it to {@linkplain java.lang.foreign.SymbolLookup#findOrThrow(java.lang.String)}
Looks like the plain text was dropped here:
Suggestion:
* and we use it to {@linkplain java.lang.foreign.SymbolLookup#findOrThrow(java.lang.String) look up}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18474#discussion_r1567435862
More information about the core-libs-dev
mailing list