void (@NotNull PsiLiteralExpression expression) { String pattern = ObjectUtils.tryCast(expression.getValue(), String.class); if (pattern == null) return; List<Token> tokens = new ArrayList<>(); char lastChar = 0; int countNonFormat = 0; char[] array = pattern.toCharArray(); boolean inQuote = false; for (int pos = 0; pos < array.length; pos++) { char c = array[pos]; if (c == '\'') inQuote = !inQuote; if (c == lastChar) continue; lastChar = c; if (!inQuote && (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z')) { countNonFormat = 0; tokens.add(new Token(pos, array)); continue; } countNonFormat++; if (countNonFormat > 3) { tokens.add(null); } } for (int i = 0; i < tokens.size(); i++) { Token token = tokens.get(i); Token prev = i > 0 ? tokens.get(i - 1) : null; Token next = i < tokens.size() - 1 ? tokens.get(i + 1) : null; Problem problem = getProblem(token, prev, next); if (problem != null) { TextRange range = ExpressionUtils.findStringLiteralRange(expression, token.pos, token.pos + token.length); if (range != null) { holder.registerProblem(expression, range, problem.toString(), new IncorrectDateFormatFix(token, range)); } } } }