Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardKotlinInline class boxing rulesSingle-choice MCQ

Given a value/inline class `Wrapper(val x: Int)`, in which of these situations does the Kotlin compiler box the inline class to a real heap object rather than using the underlying `int`?

@JvmInline value class Wrapper(val x: Int) fun takeNullable(w: Wrapper?) {} fun takeGeneric(list: MutableList<Wrapper>) {} fun takeDirect(w: Wrapper) {} val w = Wrapper(5)