Re: RFR: 8314592: Add shortcut to SymbolLookup::find [v3]

2024-04-15 Thread Maurizio Cimadamore
On Mon, 15 Apr 2024 13:48:09 GMT, Per Minborg  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+mcimadam...@users.noreply.github.com>

src/java.base/share/classes/java/lang/foreign/SymbolLookup.java line 152:

> 150: 
> 151: /**
> 152:  * Returns the address of the symbol with the given name or throws 
> an Exception.

Suggestion:

 * Returns the address of the symbol with the given name or throws an 
exception.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/18474#discussion_r1565837858


Re: RFR: 8314592: Add shortcut to SymbolLookup::find [v3]

2024-04-15 Thread Per Minborg
> 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+mcimadam...@users.noreply.github.com>

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/18474/files
  - new: https://git.openjdk.org/jdk/pull/18474/files/7de90243..e173ff09

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18474&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18474&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/18474.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18474/head:pull/18474

PR: https://git.openjdk.org/jdk/pull/18474