static Set<LookupElement> completeFinalReference(PsiElement element,
                                                   PsiJavaCodeReferenceElement reference,
                                                   ElementFilter filter,
                                                   PsiType expectedType,
                                                   CompletionParameters parameters) {
    final Set<PsiField> used = parameters.getInvocationCount() < 2 ? findConstantsUsedInSwitch(element) : Collections.emptySet();

    final Set<LookupElement> elements =
      JavaSmartCompletionContributor.completeReference(element, reference, new AndFilter(filter, new ElementFilter() {
        @Override
        public boolean isAcceptable(Object o, PsiElement context) {
          if (o instanceof CandidateInfo info) {
            final PsiElement member = info.getElement();

            if (expectedType.equals(PsiTypes.voidType())) {
              return member instanceof PsiMethod;
            }

            if (member instanceof PsiEnumConstant && used.contains(CompletionUtil.getOriginalOrSelf(member))) {
              return false;
            }

            return AssignableFromFilter.isAcceptable(member, element, expectedType, info.getSubstitutor());
          }
          return false;
        }

        @Override
        public boolean isClassAcceptable(Class hintClass) {
          return true;
        }
      }), false, true, parameters, PrefixMatcher.ALWAYS_TRUE);
    for (LookupElement lookupElement : elements) {
      if (lookupElement.getObject() instanceof PsiMethod) {
        final JavaMethodCallElement item = lookupElement.as(JavaMethodCallElement.CLASS_CONDITION_KEY);
        if (item != null) {
          item.setInferenceSubstitutorFromExpectedType(element, expectedType);
          checkTooGeneric(item);
        }
      }
    }

    return elements;
  }
static Set<LookupElement> completeFinalReference(PsiElement element,
                                                   PsiJavaCodeReferenceElement reference,
                                                   ElementFilter filter,
                                                   PsiType expectedType,
                                                   CompletionParameters parameters)