private static boolean thisEscapesToConstructor(PsiThisExpression expression, PsiNewExpression newExpression) {
      final PsiClass containingClass = PsiUtil.getContainingClass(expression);
      final PsiJavaCodeReferenceElement referenceElement = newExpression.getClassReference();
      if (referenceElement == null) {
        return false;
      }
      final PsiElement element = referenceElement.resolve();
      if (!(element instanceof PsiClass constructorClass)) {
        return false;
      }
      return !PsiTreeUtil.isAncestor(containingClass, constructorClass, false) ||
             constructorClass.hasModifierProperty(PsiModifier.STATIC);
    }
private static boolean thisEscapesToConstructor(PsiThisExpression expression, PsiNewExpression newExpression)