code: public boolean supportsLanguage(Language language) {
      try {
        List<Class<? extends Rule>> relevantRuleClasses = new ArrayList<>();
        UserConfig config = new UserConfig();
        List<Rule> relevantRules = new ArrayList<>(language.getRelevantRules(JLanguageTool.getMessageBundle(),
            config, null, Collections.emptyList()));  //  empty UserConfig has to be added to prevent null pointer exception
        relevantRules.addAll(language.getRelevantLanguageModelCapableRules(JLanguageTool.getMessageBundle(), null,
          config, null, Collections.emptyList()));
        for (Rule relevantRule : relevantRules) {
          relevantRuleClasses.add(relevantRule.getClass());
        }
        return relevantRuleClasses.contains(this.getClass());
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
docs: Whether this rule can be used for text in the given language.
  Since LanguageTool 2.6, this also works {@link org.languagetool.rules.patterns.PatternRule}s
  (before, it used to always return {@code false} for those).