languagetool-org/languagetool · error · RuntimeException

Not implemented

Error message

Not implemented

What it means

The inner rule object in GrammalecteRule only carries metadata (id, description) fetched from the remote Grammalecte server; actual matching is delegated to remote calls elsewhere. Its local match(AnalyzedSentence) method is intentionally unimplemented and always throws this RuntimeException if called directly.

Source

Thrown at languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/GrammalecteRule.java:712

    GrammalecteInternalRule(String id, String desc) {
      this.id = id;
      this.desc = desc;
    }

    @Override
    public String getId() {
      return id;
    }

    @Override
    public String getDescription() {
      return desc;
    }

    @Override
    public RuleMatch[] match(AnalyzedSentence sentence) {
      throw new RuntimeException("Not implemented");
    }
  }

}

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Do not call match() on this rule; rely on GrammalecteRule's remote fetching (ruleMatches) instead.
  2. If you need local execution, remove the Grammalecte rule from the local rule list or guard it behind remote-rule activation settings.
  3. In tests, stub the remote call rather than invoking the inner rule's match().
Defensive patterns

Strategy: type-guard

Validate before calling

if (rule instanceof GrammalecteRule.InnerRule) {
    throw new UnsupportedOperationException("This rule only matches remotely; do not call match()");
}

Type guard

boolean isRemoteOnly = rule.getClass().getName().contains("GrammalecteRule");
if (isRemoteOnly) { /* skip local match(); use remote path */ }

Try / catch

try { return rule.match(sentence); } catch (RuntimeException e) { if (e.getMessage().equals("Not implemented")) return new RuleMatch[0]; throw e; }

Prevention

When it happens

Trigger: Any code path invokes match(AnalyzedSentence) on the Grammalecte inner rule instance — e.g. registering the rule in a normal (local) rule set where the engine runs every rule's match() instead of the remote-detection code path.

Common situations: Developers adding the Grammalecte rule to a JLanguageTool instance directly; tests invoking match(); custom pipelines that iterate all rules locally, unaware this rule is remote-only.

Related errors


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/5266b954c41101f9. Report an issue: GitHub.