You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is something that old implementation did, and is great since for the times people use case classs for convenience but have a better string representation, it would use that instead of just enumerating the fields.
However, the old implementation relied on compile-time type inspection via macros, which is no longer available. We need some way to discover this using Java runtime reflection (we shouldn't depend on Scala-reflection, which is heavy/slow/buggy). As far as I can tell, "did the case class define a custom toString" isn't easily available from the bytecode.
Perhaps we could provide an annotation people can tag their case classes with, or an alternative pprintToString method they implement, to signal to PPrint that they would prefer to use their custom .toString instead of our generated default
The text was updated successfully, but these errors were encountered:
I would like this as well. The use-case being not printing sensitive information for case-classes carrying secrets. They overload the toString in order to redact their secrets.
I wouldn't mind taking a stab at this. Any code-pointers welcome though :)
This is something that old implementation did, and is great since for the times people use
case class
s for convenience but have a better string representation, it would use that instead of just enumerating the fields.However, the old implementation relied on compile-time type inspection via macros, which is no longer available. We need some way to discover this using Java runtime reflection (we shouldn't depend on Scala-reflection, which is heavy/slow/buggy). As far as I can tell, "did the case class define a custom toString" isn't easily available from the bytecode.
Perhaps we could provide an annotation people can tag their case classes with, or an alternative
pprintToString
method they implement, to signal to PPrint that they would prefer to use their custom.toString
instead of our generated defaultThe text was updated successfully, but these errors were encountered: