Class ConcreteSubtypeFinder

java.lang.Object
org.ek9lang.compiler.phase5.ConcreteSubtypeFinder

public final class ConcreteSubtypeFinder extends Object
Finds all concrete (non-abstract) subtypes of a given abstract aggregate type. Uses lazy on-demand scanning with caching — the first lookup for a given abstract type scans all aggregates across all parsed module scopes; subsequent lookups are O(1).

This component is designed for use from Phase 5 onwards where the full type hierarchy is stable. It serves DI ordering validation, dispatcher type hierarchy validation, and Phase 7 dispatch table generation.

The cache is per-instance and lives for the duration of the validation pass.

  • Constructor Details

  • Method Details

    • findConcreteSubtypes

      public List<AggregateSymbol> findConcreteSubtypes(IAggregateSymbol abstractType)
      Find all concrete (non-abstract) aggregate types that have the given abstract type in their type hierarchy. Checks both the single-inheritance super chain and the full trait hierarchy (including trait supers).
      Parameters:
      abstractType - The abstract aggregate to find subtypes/implementors of
      Returns:
      List of concrete AggregateSymbol instances extending or implementing the abstract type
    • findAllSubtypes

      public List<AggregateSymbol> findAllSubtypes(IAggregateSymbol baseType)
      Find all aggregate types (both abstract and concrete) that have the given base type in their type hierarchy. Used for dispatcher type hierarchy validation where the base type may be concrete and any subtype could implement a trait.
      Parameters:
      baseType - The base aggregate to find all subtypes/implementors of
      Returns:
      List of AggregateSymbol instances extending or implementing the base type