private static boolean matchUnqualifiedPatternReference(@NotNull PsiReferenceExpression pattern,
                                                          @Nullable PsiExpression candidateQualifier,
                                                          @NotNull Match match) {
    PsiClass contextClass = RefactoringChangeUtil.getThisClass(pattern);
    if (candidateQualifier instanceof PsiReferenceExpression) {
      final PsiElement resolved = ((PsiReferenceExpression)candidateQualifier).resolve();
      if (resolved instanceof PsiClass &&
          contextClass != null &&
          InheritanceUtil.isInheritorOrSelf(contextClass, (PsiClass)resolved, true)) {
        return true;
      }
    }
    return contextClass != null && match.registerInstanceExpression(candidateQualifier, contextClass);
  }
private static boolean matchUnqualifiedPatternReference(@NotNull PsiReferenceExpression pattern,
                                                          @Nullable PsiExpression candidateQualifier,
                                                          @NotNull Match match)