I've just checked for version 3.18.0, but every field in ToStringStyle
has a protected getter and setter. Is it not possible to call the
setters instead? The nested sub classes of ToStringStyle call these
setters in their constructors.
On 2025/09/29 11:43:12 William Degrange wrote:
Hi all,
I would like to propose a small improvement in ToStringStyle.
Currently, some boolean fields in ToStringStyle are accessed directly in
ToStringBuilder instead of through their getters. This prevents subclasses from
overriding the behavior.
My proposal is to switch the code to use the getters instead of direct field
access. This would allow subclasses to provide dynamic behavior, for example,
returning values based on a logger’s debug level, without needing to create a
new ToStringStyle instance for every toString() call.
Before opening a PR, I wanted to discuss this with the community to confirm
that this approach is acceptable.
Any thoughts or concerns?
Note : this is already the case for the 'useIdentityHashCode' field.
Thanks,
William
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]