Skip to content

Commit

Permalink
[2021.1 compat] Use raw PairProcessor as parameter for `PatternCondit…
Browse files Browse the repository at this point in the history
…ionPlus#processValues`

The API for `PatternConditionPlus#processValues` changed to take wildcard generics (PairProcessor<? super Value, ? super ProcessingContext> instead of PairProcessor<Value, ProcessingContext>) in [this commit](JetBrains/intellij-community@bb440db#diff-84c9e84629ba27c39287fb6c8630c7a61fe77d835a96eafad33f0790de09079c).

To make this work across both API levels, we use PairProcessor as a raw parameter.

PiperOrigin-RevId: 375055419
  • Loading branch information
mai93 authored and copybara-github committed May 21, 2021
1 parent 0f12b0a commit 7fa4f6f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ public class JavaClassQualifiedNameReference
psiElement(Keyword.class)
.with(nameCondition(StandardPatterns.string().oneOf(JAVA_CLASS_STRING_TYPES))));

// #api203: remove "@SuppressWarnings({"rawtypes", "RedundantSuppression"})"
@SuppressWarnings({"rawtypes", "RedundantSuppression"})
private static PatternCondition<PsiElementBase> nameCondition(final ElementPattern<?> pattern) {
return new PatternConditionPlus<PsiElementBase, String>("_withPsiName", pattern) {
@Override
public boolean processValues(
PsiElementBase t,
ProcessingContext context,
PairProcessor<String, ProcessingContext> processor) {
// #api203 replace with "PairProcessor<? super String, ? super ProcessingContext>"
PairProcessor processor) {
return processor.process(t.getName(), context);
}
};
Expand Down

0 comments on commit 7fa4f6f

Please sign in to comment.