Class OverriddenDeclarations

java.lang.Object
org.ek9lang.compiler.support.OverriddenDeclarations

public final class OverriddenDeclarations extends Object
THE parent declarations a method overrides - use this, do not re-derive it.

A method overrides exactly the parent declarations (the super class's and each trait's) with EXACTLY its signature: the same name and exactly the same parameter types (MethodSymbol.hasSameSignatureAs(MethodSymbol); Steve, 2026-10-02, N06), taken from each parent's getAllEffectiveMethods() - the override-collapsed view, where a declaration further down a parent's own chain replaces what it overrides.

Two decisions read it, and must agree: phase 3's override rule (MethodOverridesOrError: is 'override' required, is it wrong) and phase 7's covariant bridges (narrowedReturnTypes(IAggregateSymbol, MethodSymbol), N07: the return types a back end must also make the override reachable under, since a JVM method's identity includes its return type).

  • Method Details

    • parentsOf

      public static List<IAggregateSymbol> parentsOf(IAggregateSymbol aggregate)
      The parents a method can override: the super class, then each trait.
    • of

      public static List<MethodSymbol> of(IAggregateSymbol aggregate, MethodSymbol method)
      Every parent declaration with exactly this method's signature - at most one per parent - private ones included: a private parent member is not inherited, so not overridden, and the caller decides what that means.
    • narrowedReturnTypes

      public static List<ISymbol> narrowedReturnTypes(IAggregateSymbol aggregate, MethodSymbol method)
      The return types of the (non-private) parent declarations this method overrides with a NARROWER - covariant - return, one per distinct type. Empty for a method that overrides nothing or keeps every parent's return type. A declaration further up is already reachable through the parent's own bridge, so only the nearest declaration of each parent counts.
    • narrowedReturnTypes

      public static List<ISymbol> narrowedReturnTypes(FunctionSymbol function)
      The same for a function: the super function's return type, when this function narrows it.