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:
- Store a body fingerprint on every method with a body (as squirrelled data)
- 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 Summary
ConstructorsConstructorDescriptionRedundantOverrideOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
-
Constructor Details
-
RedundantOverrideOrError
RedundantOverrideOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
-