Class MonomorphizationScenarioDetector

java.lang.Object
org.ek9lang.compiler.phase7.MonomorphizationScenarioDetector
All Implemented Interfaces:
Function<PossibleGenericSymbol, MonomorphizationScenarioDetector.Scenario>

public final class MonomorphizationScenarioDetector extends Object implements Function<PossibleGenericSymbol, MonomorphizationScenarioDetector.Scenario>
Detects which monomorphization scenario applies to a parameterized type.

There are three scenarios:

  1. PREBUILT - A Java class already exists for this exact parameterization (e.g., _Iterator_2648BF49... for Iterator of Integer). No generation needed. Detection: PRE_BUILT flag is set on the symbol during creation.
  2. EXTERN_DELEGATION - The generic type is Java-implemented (extern), but no pre-built class exists for this parameterization. Generate a delegation wrapper.
  3. USER_DEFINED_SOURCE - The generic type is defined in EK9 source. Generate from source with type substitution.

This approach is backend-agnostic (works for both JVM and LLVM backends) and supports third-party modules that provide pre-built parameterized types.