Class DispatcherExhaustivenessOrError

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

final class DispatcherExhaustivenessOrError extends Object
Validates that dispatchers on sealed traits have handlers for all permitted types.

When a dispatcher's first parameter type is a sealed trait (one with an 'allow only' clause), the compiler can verify that the dispatcher has a handler method for every type in the permitted list. This provides exhaustive matching — similar to Java's sealed switch or Kotlin's sealed when — ensuring that adding a new type to the 'allow only' list will force all dispatchers to be updated.

Only the first parameter of each dispatcher entry point is checked. Handler methods must have the same name and parameter count as the dispatcher entry point, with the first parameter type matching a specific permitted type.

  • Constructor Details

    • DispatcherExhaustivenessOrError

      DispatcherExhaustivenessOrError()
  • Method Details