@Nullable
  private static @Nls String getCannotInlineDueToUsagesMessage(final PsiClass aClass) {
    boolean hasUsages = false;
    for(PsiReference reference : ReferencesSearch.search(aClass, GlobalSearchScope.projectScope(aClass.getProject()))) {
      final PsiElement element = reference.getElement();
      if (!PsiTreeUtil.isAncestor(aClass, element, false)) {
        hasUsages = true;
      }
      final PsiElement parentElement = element.getParent();
      if (parentElement != null) {
        final PsiElement grandPa = parentElement.getParent();
        if (grandPa instanceof PsiClassObjectAccessExpression) {
          return JavaBundle.message("class.cannot.be.inlined.because.it.has.usages.of.its.class.literal");
        }
        if (ourCatchClausePattern.accepts(parentElement)) {
          return JavaBundle.message("class.cannot.be.inlined.because.it.is.used.in.a.catch.clause");
        }
      }
      if (ourThrowsClausePattern.accepts(element)) {
        return JavaBundle.message("class.cannot.be.inlined.because.it.is.used.in.a.throws.clause");
      }
      if (parentElement instanceof PsiThisExpression) {
        return JavaBundle.message("class.cannot.be.inlined.because.it.is.used.as.a.this.qualifier");
      }
      if (parentElement instanceof PsiNewExpression newExpression && !newExpression.isArrayCreation()) {
        final PsiMethod[] constructors = aClass.getConstructors();
        if (constructors.length == 0) {
          PsiExpressionList newArgumentList = newExpression.getArgumentList();
          if (newArgumentList != null && !newArgumentList.isEmpty()) {
            return JavaBundle.message("class.cannot.be.inlined.because.a.call.to.its.constructor.is.unresolved");
          }
        }
        else {
          final JavaResolveResult resolveResult = newExpression.resolveMethodGenerics();
          if (!resolveResult.isValidResult()) {
            return JavaBundle.message("class.cannot.be.inlined.because.a.call.to.its.constructor.is.unresolved");
          }
        }
      }
    }
    if (!hasUsages) {
      return JavaRefactoringBundle.message("class.is.never.used");
    }
    return null;
  }
@Nullable
  private static @Nls String getCannotInlineDueToUsagesMessage(final PsiClass aClass)