private MultiMap<PsiElement, String> isOKImpl(String varName, boolean replaceAllOccurrences) {
    PsiElement firstOccurrence = getFirstOccurrence(replaceAllOccurrences);

    final MultiMap<PsiElement, String> conflicts = new MultiMap<>();
    assert varName != null;

    final int offset = firstOccurrence.getTextRange().getStartOffset();

    validateOccurrencesDown(myContext.getScope(), conflicts, varName, offset);
    if (!(myContext.getScope() instanceof GroovyFileBase)) {
      validateVariableOccurrencesUp(myContext.getScope(), conflicts, varName, offset);
    }

    if (replaceAllOccurrences) {
      for (PsiElement element : myContext.getOccurrences()) {
        if (element == firstOccurrence) continue;
        validateVariableOccurrencesUp(element, conflicts, varName, element.getTextRange().getStartOffset());
      }
    }
    return conflicts;
  }
private MultiMap<PsiElement, String> isOKImpl(String varName, boolean replaceAllOccurrences)