diff --git a/config/src/main/java/com/typesafe/config/impl/SimpleConfigList.java b/config/src/main/java/com/typesafe/config/impl/SimpleConfigList.java index 5ec13f29..ec5a4b98 100644 --- a/config/src/main/java/com/typesafe/config/impl/SimpleConfigList.java +++ b/config/src/main/java/com/typesafe/config/impl/SimpleConfigList.java @@ -98,7 +98,11 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList, } if (changed != null) { - return new SimpleConfigList(origin(), changed, newResolveStatus); + if (newResolveStatus != null) { + return new SimpleConfigList(origin(), changed, newResolveStatus); + } else { + return new SimpleConfigList(origin(), changed); + } } else { return this; } @@ -122,7 +126,7 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList, return context.resolve(v); } - }, ResolveStatus.RESOLVED); + }, null /* don't force resolve status -- could be allowing unresolved */); } catch (NotPossibleToResolve e) { throw e; } catch (RuntimeException e) { diff --git a/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala b/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala index a68f3897..568c19a0 100644 --- a/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala +++ b/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala @@ -1120,9 +1120,10 @@ class ConfigTest extends TestUtils { @Test def allowUnresolvedDoesAllowUnresolved() { - val values = ConfigFactory.parseString("{ foo = 1, bar = 2, m = 3, n = 4}") + val values = ConfigFactory.parseString("{ foo = 1, bar = 2, m = 3, n = 4, unknown = [someVal]}") assertTrue("config with no substitutions starts as resolved", values.isResolved) - val unresolved = ConfigFactory.parseString("a = ${foo}, b = ${bar}, c { x = ${m}, y = ${n}, z = foo${m}bar }, alwaysResolveable=${alwaysValue}, alwaysValue=42") + val unresolved = ConfigFactory.parseString( + "l = [${unknown}[]], l2 = [${unknown}, ${alwaysValue}], a = ${foo}, b = ${bar}, c { x = ${m}, y = ${n}, z = foo${m}bar }, alwaysResolveable=${alwaysValue}, alwaysValue=42") assertFalse("config with substitutions starts as not resolved", unresolved.isResolved) // resolve() by default throws with unresolveable substs