private @Nullable LookupElement generateLookupElementDecorator(@Nullable PsiType qualifierType, @NotNull Object object,
                                                                   @NotNull Function<Consumer<LookupElementPresentation>, LookupElementDecorator<LookupElement>> generator) {
      if (object instanceof PsiMember) {
        if (LanguageLevelUtil.getLastIncompatibleLanguageLevel((PsiMember)object, myLanguageLevel) != null) {
          LookupElementDecorator<LookupElement> element = generator.apply(presentation -> presentation.setItemTextForeground(JBColor.RED));
          return PrioritizedLookupElement.withExplicitProximity(element, -1);
        }
        if (object instanceof PsiEnumConstant psiEnumConstant &&
            myConstantsUsedInSwitch.contains(CompletionUtil.getOriginalOrSelf(psiEnumConstant))) {
          LookupElementDecorator<LookupElement> element = generator.apply(presentation -> presentation.setItemTextForeground(JBColor.RED));
          return PrioritizedLookupElement.withExplicitProximity(element, -1);
        }
        if (object instanceof PsiClass psiClass) {
          if (ReferenceListWeigher.INSTANCE.getApplicability(psiClass, myPlace) == inapplicable) {
            LookupElementDecorator<LookupElement> element = generator.apply(presentation -> presentation.setItemTextForeground(JBColor.RED));
            return PrioritizedLookupElement.withExplicitProximity(element, -1);
          }
          if (PsiUtil.isAvailable(JavaFeature.MODULES, myPlace)) {
            final PsiJavaModule currentModule =
              ReadAction.compute(() -> JavaModuleGraphUtil.findDescriptorByFile(myOriginalFile, myPlace.getProject()));
            if (currentModule != null) {
              final PsiJavaModule targetModule = ReadAction.compute(() -> JavaModuleGraphUtil.findDescriptorByElement(psiClass));
              if (targetModule != null && targetModule != currentModule &&
                  !JavaModuleGraphUtil.reads(currentModule, targetModule)) {
                LookupElementDecorator<LookupElement> element = generator.apply(presentation -> presentation.setItemTextForeground(JBColor.RED));
                return PrioritizedLookupElement.withExplicitProximity(element, -1);
              }
            }
          }
        }
      }
      if (containsMember(qualifierType, object, false) && !qualifierType.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
        LookupElementDecorator<LookupElement> element = generator.apply(presentation -> presentation.setItemTextBold(true));
        return object instanceof PsiField ? element : PrioritizedLookupElement.withExplicitProximity(element, 1);
      }
      return null;
    }
private @Nullable LookupElement generateLookupElementDecorator(@Nullable PsiType qualifierType, @NotNull Object object,
                                                                   @NotNull Function<Consumer<LookupElementPresentation>, LookupElementDecorator<LookupElement>> generator)