RFR: 8314592: Add shortcut to SymbolLookup::find [v2]

Per Minborg pminborg at openjdk.org
Mon Apr 15 08:37:55 UTC 2024


> 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

-------------

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

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

  Stats: 13 lines in 1 file changed: 3 ins; 2 del; 8 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


More information about the core-libs-dev mailing list