public static @Nullable ModCommandAction createFix(@NotNull PsiMethodCallExpression callExpression,
                                                     @NotNull String method) {
    if (!myCallMatcher.matches(callExpression)) {
      return null;
    }

    PsiReferenceExpression expressionPrint = callExpression.getMethodExpression();
    if (!(expressionPrint.getQualifierExpression() instanceof PsiReferenceExpression expression)) {
      return null;
    }
    String name = expression.getReferenceName();
    if (!HardcodedMethodConstants.OUT.equals(name) &&
        !HardcodedMethodConstants.ERR.equals(name)) {
      return null;
    }

    PsiElement referent = expression.resolve();
    if (!(referent instanceof PsiField systemField)) {
      return null;
    }

    final PsiClass containingClass = systemField.getContainingClass();
    if (containingClass == null) {
      return null;
    }
    final String className = containingClass.getQualifiedName();
    if (!JAVA_LANG_SYSTEM.equals(className)) {
      return null;
    }

    if (callExpression.getArgumentList().getExpressions().length != 1) {
      return null;
    }

    Module module = ModuleUtilCore.findModuleForFile(callExpression.getContainingFile());
    if (module == null) {
      return null;
    }

    List<JvmLogger> loggers = JvmLogger.Companion.findSuitableLoggers(module, true);

    if (loggers.isEmpty()) {
      return null;
    }

    PsiClass psiClass = getUpperClass(callExpression);
    if (psiClass == null) {
      return null;
    }

    Project project = callExpression.getProject();
    GlobalSearchScope globalSearchScope = GlobalSearchScope.everythingScope(project);
    List<JvmLogger> loggersWithTargetMethod = new ArrayList<>();
    for (JvmLogger logger : loggers) {
      PsiClass loggerClass = JavaPsiFacade.getInstance(project).findClass(logger.getLoggerTypeName(), globalSearchScope);
      if (loggerClass != null && loggerClass.findMethodsByName(method, true).length > 0 &&
          SUPPORTED_LOGGING_SYSTEMS.contains(logger.getId())) {
        loggersWithTargetMethod.add(logger);
      }
    }

    if (loggersWithTargetMethod.isEmpty()) {
      return null;
    }

    List<PsiField> existedLoggers = new ArrayList<>();
    PsiField[] fields = psiClass.getFields();
    Set<String> allSupportedLoggers = loggersWithTargetMethod.stream().map(log -> log.getLoggerTypeName()).collect(Collectors.toSet());
    for (PsiField field : fields) {
      if (allSupportedLoggers.contains(field.getType().getCanonicalText())) {
        existedLoggers.add(field);
      }
    }

    if (!existedLoggers.isEmpty()) {
      String possibleLogName = existedLoggers.get(0).getName();
      PsiResolveHelper helper = JavaPsiFacade.getInstance(project).getResolveHelper();
      PsiVariable variable = helper.resolveAccessibleReferencedVariable(possibleLogName, callExpression);
      if (variable instanceof PsiField field &&
          allSupportedLoggers.contains(field.getType().getCanonicalText())) {
        return new ConvertSystemOutToLogCallFix(loggersWithTargetMethod, possibleLogName, method, callExpression);
      }
      return null;
    }

    List<JvmLogger> availableLoggers = new ArrayList<>();
    for (JvmLogger logger: loggersWithTargetMethod) {
      String logFieldName = logger.getLogFieldName(psiClass);
      if (logFieldName == null) {
        continue;
      }
      String proposedName = new VariableNameGenerator(callExpression, VariableKind.LOCAL_VARIABLE).byName(logFieldName)
        .generate(true);
      if (!proposedName.equals(logFieldName)) {
        continue;
      }

      if (logger.isPossibleToPlaceLoggerAtClass(psiClass)) {
        availableLoggers.add(logger);
      }
    }

    if (availableLoggers.isEmpty()) {
      return null;
    }

    JvmLoggingSettingsStorage loggingSettingsStorage = project.getService(JvmLoggingSettingsStorage.class);
    JvmLoggingSettingsStorage.State state = loggingSettingsStorage.getState();
    String id = state.getLoggerId();

    if (UNSPECIFIED_LOGGER_ID.equals(id)) {
      return new ConvertSystemOutToLogCallFix(availableLoggers, null, method, callExpression);
    }

    Optional<JvmLogger> chosenLogger = availableLoggers.stream().filter(log -> log.getId().equals(id)).findAny();
    if (chosenLogger.isEmpty()) {
      return null;
    }

    return new ConvertSystemOutToLogCallFix(chosenLogger.stream().toList(), null, method, callExpression);
  }
public static @Nullable ModCommandAction createFix(@NotNull PsiMethodCallExpression callExpression,
                                                     @NotNull String method)