void (RegExpClass regExpClass) { super.visitRegExpClass(regExpClass); final RegExpClassElement[] elements = regExpClass.getElements(); for (RegExpClassElement element : elements) { if (element instanceof RegExpCharRange range) { final int from = range.getFrom().getValue(); final RegExpChar to = range.getTo(); if (from != -1 && to != null && from == to.getValue()) { // [a-abc] -> [abc] registerProblem(range, to.getUnescapedText()); } } } if (regExpClass.isNegated()) { if (elements.length == 1) { final RegExpClassElement element = elements[0]; if (element instanceof RegExpSimpleClass simpleClass) { final String text = getInverseSimpleClassText(simpleClass); if (text != null) { // [^\d] -> \D registerProblem(regExpClass, text); } } } } else { if (elements.length == 1) { final RegExpClassElement element = elements[0]; if (element instanceof RegExpPosixBracketExpression) return; if (!(element instanceof RegExpCharRange)) { if (!(element instanceof RegExpChar) || !"{}().*+?|$".contains(element.getText())) { // [a] -> a registerProblem(regExpClass, element.getUnescapedText()); } } } } }