config
config copied to clipboard
Array concatenation missing checks
I'm reviewing HOCON's array-and-object-concatenation and wondering what the expected parse result should be for "wrong" inputs like the following:
-
list = [0, 1] | [2,3]
-
list = [0] bar baz [1,2,3]
-
list = [0] abc [bar, baz] ||| xyz [1,2,3]
Per the rendering program below, the non-array tokens in between the arrays seem to just be silently ignored:
-
list = [0, 1] | [2,3]
:{ "list" : [ 0, 1, 2, 3 ] }
-
list = [0] bar baz [1,2,3]
:{ "list" : [ 0, 1, 2, 3 ] }
-
list = [0] abc [bar, baz] ||| xyz [1,2,3]
:{ "list" : [ 0, "bar", "baz", 1, 2, 3 ] }
Shouldn't an exception be thrown in these cases? Thanks.
Config c = ConfigFactory.parseString(input).resolve();
ConfigRenderOptions options = ConfigRenderOptions.defaults().setOriginComments(false);
System.out.println(c.root().render(options));
Without carefully re-reading the spec and code, my first impression is that I agree with you, I would expect an exception in these cases.