private void checkForDuplicates(RegExpClassElement element, Set<Object> seen) {
      if (element instanceof RegExpChar regExpChar) {
        final int value = regExpChar.getValue();
        if (value != -1 && !seen.add(value)) {
          myHolder.registerProblem(regExpChar,
                                   RegExpBundle.message("warning.duplicate.character.0.inside.character.class", regExpChar.getText()),
                                   new DuplicateCharacterInClassFix(regExpChar));
        }
      }
      else if (element instanceof RegExpSimpleClass regExpSimpleClass) {
        final RegExpSimpleClass.Kind kind = regExpSimpleClass.getKind();
        if (!seen.add(kind)) {
          final String text = regExpSimpleClass.getText();
          myHolder.registerProblem(regExpSimpleClass,
                                   RegExpBundle.message("warning.duplicate.predefined.character.class.0.inside.character.class", text),
                                   new DuplicateCharacterInClassFix(regExpSimpleClass));
        }
      }
    }
private void checkForDuplicates(RegExpClassElement element, Set<Object> seen)