Thanks for the quick response. Perhaps I'm reading it wrong but I don't see any examples matching my use case. I do not want multiple implementations of the
Node
class, and I do not control objects of type
T
(3rd party classes). So the type information of the
value
property I want to keep external to the instance.
aarjav
10/14/2020, 2:18 PM
I would also like to later put them in a container class
data class Graph<T: Any>(val nodes: List<Node<out T>>)
g
gildor
10/14/2020, 2:34 PM
not sure that this use case supported directly, with generic List, but maybe you could have a base class Node<T> and particular implementation NodeFoo, NodeBar, it already supported with custom serializer registration