mirror of
https://github.com/lightbend/config.git
synced 2025-03-24 16:20:40 +08:00
The basic idea in this patch is to unify on the "replacer" (modifying the tree in which we lookup substitutions) mechanism for detecting cycles. Drop the "traverse" method, instead keeping a trace of expressions we've passed through for nice error messages. There is now only one internal checked exception possible, NotPossibleToResolve which is thrown when a cycle is detected; this checked exception is always caught by ConfigReference so cannot "escape" from the library. The exception exists because we want to get the traceString debug info out of the spot that detected the cycle, if we didn't want that debug info we could just return null as usual for undefined. As part of simplifying this (which should also simplify the spec), resolutions which require double-traverse of the same reference are no longer supported: a=1, b=${a}, a=${b} Also, cycles now always throw UnresolvedSubstitution rather than BadValue. This was needed for consistency since conceptually a single a=${a} is going to "look back" earlier in the merge stack, discover there is no earlier value of a, and fail; it should be the same exception as a=${a},a={b:1}, and in both cases referring to these cycles via ${?} should hide the exception. |
||
---|---|---|
.. | ||
src | ||
build.sbt |