private static boolean hasUnresolvableWriteAccess(Collection<PsiReference> refs, GrExpression expression) {
    if (containsWriteAccess(refs)) {
      if (expression instanceof GrReferenceExpression) {
        final PsiElement resolved = ((GrReferenceExpression)expression).resolve();

        if (resolved instanceof GrVariable && !(resolved instanceof PsiField)) {
          final boolean isFinal = ((GrVariable)resolved).hasModifierProperty(PsiModifier.FINAL);
          if (!isFinal) {
            final PsiReference lastRef =
              Collections.max(ReferencesSearch.search(resolved).findAll(),
                              Comparator.comparingInt(o -> o.getElement().getTextRange().getStartOffset()));
            return lastRef.getElement() == expression;
          }
        }
      }
      return false;
    }

    return true;
  }
private static boolean hasUnresolvableWriteAccess(Collection<PsiReference> refs, GrExpression expression)