Closed Andrapyre closed 1 month ago
Thanks for the PR! I'll take a detailed look in a couple of days, but for sure we'll need to find a way to keep bincompat. Or move these changes to v2.
Since this would break new CallByNeed(param) and force users to use CallByNeed(param), I tried to find some examples of libs where users would need to make this change, but I couldn't find any instances outside of Magnolia where this implementation is actually being used. See this search. It seems that breaking this would likely have minimal effect, if any.
It can break when you have two dependencies that use Magnolia on the classpath, one the older version using the constructor, and another one the newer version using apply
. You can add another constructor to keep binary compatibility.
I've adjusted both PRs to keep bincompat. Build should be passing now.
Thanks for the PR!
Description
Currently, all default values are precompiled. This has led to random generators, such as random
UUID.randomUUID()
andInstant.now()
being memoized (see https://github.com/zio/zio-json/issues/1055). This PR adds an option to evaluate default parameters on-demand. See the accompanying PR for Scala 3 support: https://github.com/softwaremill/magnolia/pull/534