Skip to content

Commit

Permalink
Add getSymbols(Predicate, LookupKind) compatibility method
Browse files Browse the repository at this point in the history
  • Loading branch information
fawind committed Oct 18, 2021
1 parent 252f6c4 commit e843406
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public Iterable<Symbol> getSymbols(Predicate<Symbol> predicate) {
return (Iterable<Symbol>) invoke(getSymbols, maybeAsFilter(predicate));
}

@SuppressWarnings("unchecked") // reflection
public Iterable<Symbol> getSymbols(Predicate<Symbol> predicate, LookupKind lookupKind) {
return (Iterable<Symbol>) invoke(getSymbolsLookupKind, maybeAsFilter(predicate), lookupKind);
}

public boolean anyMatch(Predicate<Symbol> predicate) {
return (boolean) invoke(anyMatch, maybeAsFilter(predicate));
}
Expand Down Expand Up @@ -75,6 +80,8 @@ private static Class<?> getFilterClass() {

private static final Method getSymbols = getImpl("getSymbols", Predicate.class);

private static final Method getSymbolsLookupKind = getImpl("getSymbols", Predicate.class, LookupKind.class);

private static Method getImpl(String name, Class<?>... parameters) {
return FILTER_CLASS != null
? getMethodOrDie(
Expand Down

0 comments on commit e843406

Please sign in to comment.