Is there a way to annotate type parameters as not needing to be serializable to serialize a class in kotlinx-serialization? Ex.
Copy code
@Serializable
class Foo<T> { /*...*/ }
I would want to communicate to the compiler that the type parameter
T
is not needed during serialization, and so it doesn't need to be marked as contextual at the use-site. Currently I have to do this everywhere that I use `Foo`:
Copy code
interface Bar {
val foo: Foo<@Contextual Bar>,
// ...
}
➕ 1
j
joseph_ivie
08/18/2025, 2:08 PM
I'd very much also like to know this. I've had to work around this a decent amount, actually.