private static boolean processFieldUsages(final @NotNull PsiField field,
                                            final @NotNull JavaSliceBuilder builder,
                                            final @NotNull Processor<? super SliceUsage> processor) {
    if (field.hasInitializer()) {
      PsiExpression initializer = field.getInitializer();
      if (initializer != null && !(field instanceof PsiCompiledElement)) {
        if (!builder.process(initializer, processor)) return false;
      }
    }
    AnalysisScope scope = builder.getParent().getScope();
    SearchScope searchScope = builder.getSearchScope();
    return ReferencesSearch.search(field, searchScope).forEach(reference -> {
      ProgressManager.checkCanceled();
      PsiElement element = reference.getElement();
      if (element instanceof PsiCompiledElement) {
        element = element.getNavigationElement();
        if (!scope.contains(element)) return true;
      }
      if (element instanceof PsiReferenceExpression referenceExpression) {
        PsiElement parentExpr = referenceExpression.getParent();
        if (PsiUtil.isOnAssignmentLeftHand(referenceExpression)) {
          PsiExpression rExpression = ((PsiAssignmentExpression)parentExpr).getRExpression();
          if (rExpression != null) {
            PsiType rType = rExpression.getType();
            PsiType fType = field.getType();
            PsiType subFType = builder.substitute(fType);
            PsiType subRType = builder.substitute(rType);
            if (subFType != null && subRType != null && TypeConversionUtil.isAssignable(subFType, subRType)) {
              return builder.process(rExpression, processor);
            }
          }
        }
        if (parentExpr instanceof PsiUnaryExpression unaryExpression && unaryExpression.getOperand() == referenceExpression && (
          unaryExpression.getOperationTokenType() == JavaTokenType.PLUSPLUS || unaryExpression.getOperationTokenType() == JavaTokenType.MINUSMINUS)) {
          return builder.process(unaryExpression, processor);
        }
      }

      return processIfInForeignLanguage(builder.dropNesting(), processor, element);
    });
  }
private static boolean processFieldUsages(final @NotNull PsiField field,
                                            final @NotNull JavaSliceBuilder builder,
                                            final @NotNull Processor<? super SliceUsage> processor)