RFR: 8287834: Add SymbolLookup::or method

Maurizio Cimadamore mcimadamore at openjdk.org
Fri May 12 12:18:50 UTC 2023


This patch adds a simpler method for composing symbol lookups. It is common for clients to chain multiple symbol lookups together, e.g. to find a symbol in multiple libraries.

A new instance method, namely `SymbolLookup::or` is added, which first searches a symbol in the first lookup, and, if that fails, proceeds to search the symbol in the provided lookup.

We have considered alternatives to express this, such as a static factory `SymbolLookup::ofComposite` but settled on this because of the similarity with `Optional::or`.

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

Commit messages:
 - Add test for composite lookups
 - Initial push

Changes: https://git.openjdk.org/jdk/pull/13954/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13954&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8287834
  Stats: 169 lines in 2 files changed: 169 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/13954.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13954/head:pull/13954

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


More information about the core-libs-dev mailing list