Class RedundantOverrideOrError

java.lang.Object
org.ek9lang.compiler.phase5.RedundantOverrideOrError
All Implemented Interfaces:
Consumer<org.antlr.v4.runtime.tree.ParseTree>

final class RedundantOverrideOrError extends Object implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Detects when an override method/operator body is textually identical to the super (E11044).

A redundant override adds no value - the inherited implementation already provides identical behaviour. This typically occurs from copy-paste or AI-generated code.

This checker operates in two phases per method:

  1. Store a body fingerprint on every method with a body (as squirrelled data)
  2. For override methods, compare fingerprint with the super method's fingerprint

Exemptions (override is NOT flagged as redundant):

  • Defaulted (compiler-generated) methods/operators
  • Externally implemented (Java-backed) methods
  • Abstract methods (no body to compare)
  • Overrides compelled by trait method conflicts (E06150)
  • Constructor Details

  • Method Details

    • accept

      public void accept(org.antlr.v4.runtime.tree.ParseTree node)
      Specified by:
      accept in interface Consumer<org.antlr.v4.runtime.tree.ParseTree>