Le 18/11/2024 à 17:11, Gary Gregory a écrit :
-1 you are undoing the port to JUnit 5. This commit is a classic JUnit
mistake imo, please stop, these JUnit APIs exist for a reason: The lambdas
avoid construction of failure message strings, which, as a pattern, add
processing, can have side effects, and always creates more garbage. This is
bad since in general toString() methods can do anything. String.format() is
a great way to create nice messages in a compact way but is not free.
(reposting since the reply was mistakenly sent to Gary instead of the
mailing list)
The JUnit 5 documentation [1] states:
"When using a Supplier<String> (e.g., a lambda expression), the message
is evaluated lazily. This can provide a performance benefit, especially
if message construction is complex or time-consuming, as it is only
evaluated when the assertion fails."
Simple string concatenations are neither complex nor time-consuming.
It's nowhere mentioned that the direct value construct is deprecated or
discouraged.
If you can prove your claim by demonstrating that this readability
improvement degrades the build time of Commons Validator by more than
0.01% I'll happily revert it.
Emmanuel Bourg
[1] https://junit.org/junit5/docs/snapshot/user-guide/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org