boolean (@NotNull final PsiField field, @NotNull final JavaSliceBuilder builder, @NotNull final 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 && ((PsiUnaryExpression)parentExpr).getOperand() == referenceExpression && (((PsiUnaryExpression)parentExpr).getOperationTokenType() == JavaTokenType.PLUSPLUS || ((PsiUnaryExpression)parentExpr).getOperationTokenType() == JavaTokenType.MINUSMINUS)) { return builder.process(unaryExpression, processor); } } return processIfInForeignLanguage(builder.dropNesting(), processor, element); }); }