Skip to content

L11: Advanced Generics and Variance

In this lesson we will explore:

  • Deep Theory: Generic classes and functions <T>, upper bounds (T : Any), Declaration-site variance (out / Covariance and in / Contravariance), Star projections (*), and reified type parameters via inline functions.
  • Under the Hood: JVM Type Erasure and how Kotlin circumvents this restriction through bytecode inlining.
  • Incremental Lab (AI Chat CLI): Authoring a strongly-typed Result<T> sealed wrapper and generic response adapters to process AI completions.