Join Slack
Powered by
Is it possible to hide fields from toString in dat...
# announcements
s
steenooo
05/22/2020, 9:44 PM
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
LeoColman
05/22/2020, 9:50 PM
You can override the toString
👍 3
r
Robert Jaros
05/22/2020, 10:51 PM
https://github.com/ZacSweers/redacted-compiler-plugin
m
Matteo Mirk
05/23/2020, 4:03 PM
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
49
Views
Open in Slack
Previous
Next