private static boolean isAnonymous(@NotNull PsiCall call) {
    if (!(call instanceof PsiNewExpression newExpression)) {
      return false;
    }

    PsiImmediateClassType targetType = ObjectUtils.tryCast(newExpression.getType(), PsiImmediateClassType.class);
    if (targetType == null) return false;

    return targetType.resolve() instanceof PsiAnonymousClass;
  }
private static boolean isAnonymous(@NotNull PsiCall call)