Is it possible to hide fields from toString in dat...
# announcements
s
Is it possible to hide fields from toString in data classes? I have a problem where one class has a list objects. Each object contains a reference to the first class. This is causing a stackoverflow in toString
l
You can override the toString
👍 3
m
it’s possibile if you declare properties in the class body, outside the constructor, since the compiler will generate toString() only for constructor properties. https://kotlinlang.org/docs/reference/data-classes.html#properties-declared-in-the-class-body