On Tue, 16 May 2023 16:48:13 GMT, Paul Sandoz <psan...@openjdk.org> wrote:
>> 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`. > > src/java.base/share/classes/java/lang/foreign/SymbolLookup.java line 136: > >> 134: * lookup} More specifically, if a symbol is not found using this >> lookup, the provided lookup will be >> 135: * used as fallback. In other words, the resulting symbol lookup >> will only return {@linkplain Optional#empty()} >> 136: * if both lookups fail to retrieve a given symbol. > > Suggestion: > > * {@return a composed symbol lookup that returns result of finding the > symbol with this lookup if found, otherwise returns the result of finding the > symbol with the other lookup.} I was trying to split the sentence so that we could get a compact javadoc header for the factory. How much important is that? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13954#discussion_r1195443068