tezvyn:

What is a reified type parameter in Kotlin?

Source: kotlinlang.orgadvanced

Tests your grasp of JVM type erasure and Kotlin's solution. Explain that `reified` makes a generic type accessible at runtime inside an `inline` function, avoiding manual `Class` passing. A red flag is failing to link `reified` directly to `inline` functions.

This tests your understanding of JVM type erasure and Kotlin's `inline` function solution. A strong answer explains that `reified` preserves generic type information at runtime, but *only* within `inline` functions. This works because the compiler replaces the call with the function's body and the actual type, enabling checks like `is T` and avoiding the need to pass `MyClass::class.java` explicitly. A red flag is discussing `reified` without mentioning its absolute dependency on `inline`.

Read the original → kotlinlang.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

What is a reified type parameter in Kotlin? · Tezvyn