@Nullable
  private Boolean matchReferenceElement(@NotNull PsiJavaCodeReferenceElement pattern,
                                        @NotNull PsiJavaCodeReferenceElement candidate,
                                        @NotNull List<? extends PsiElement> candidates,
                                        @NotNull Match match) {
    final PsiElement resolveResult1 = pattern.resolve();
    final PsiElement resolveResult2 = candidate.resolve();
    if (resolveResult1 instanceof PsiClass && resolveResult2 instanceof PsiClass) return true;
    if (isUnder(resolveResult1, myPatternAsList) && isUnder(resolveResult2, candidates)) {
      traverseParameter(resolveResult1, resolveResult2, match);
      return match.putDeclarationCorrespondence(resolveResult1, resolveResult2);
    }
    if (resolveResult1 instanceof PsiVariable && myEffectivelyLocal.contains((PsiVariable)resolveResult1)) {
      return PsiUtil.isJvmLocalVariable(resolveResult2) &&
             match.putDeclarationCorrespondence(resolveResult1, resolveResult2);
    }
    PsiElement qualifier2 = candidate.getQualifier();
    while (qualifier2 instanceof PsiParenthesizedExpression) {
      qualifier2 = ((PsiParenthesizedExpression)qualifier2).getExpression();
    }
    if (!equivalentResolve(resolveResult1, resolveResult2, qualifier2)) {
      return matchExtractableVariable(pattern, candidate, match);
    }
    PsiElement qualifier1 = pattern.getQualifier();
    while (qualifier1 instanceof PsiParenthesizedExpression) {
      qualifier1 = ((PsiParenthesizedExpression)qualifier1).getExpression();
    }
    if (qualifier1 instanceof PsiReferenceExpression && qualifier2 instanceof PsiReferenceExpression &&
        !match.areCorrespond(((PsiReferenceExpression)qualifier1).resolve(), ((PsiReferenceExpression)qualifier2).resolve())) {
      return false;
    }

    if (qualifier1 == null && qualifier2 == null) {
      final PsiClass patternClass = RefactoringChangeUtil.getThisClass(pattern);
      final PsiClass candidateClass = RefactoringChangeUtil.getThisClass(candidate);
      if (resolveResult1 == resolveResult2 &&
          resolveResult1 instanceof PsiMember) {
        final PsiClass containingClass = ((PsiMember)resolveResult1).getContainingClass();
        if (!InheritanceUtil.isInheritorOrSelf(candidateClass, patternClass, true) &&
            InheritanceUtil.isInheritorOrSelf(candidateClass, containingClass, true) &&
            InheritanceUtil.isInheritorOrSelf(patternClass, containingClass, true)) {
          return false;
        }
      }
    }
    return null;
  }
@Nullable
  private Boolean matchReferenceElement(@NotNull PsiJavaCodeReferenceElement pattern,
                                        @NotNull PsiJavaCodeReferenceElement candidate,
                                        @NotNull List<? extends PsiElement> candidates,
                                        @NotNull Match match)