BUG-7025: make the parser tree immutable 93/47593/3
authorRobert Varga <rovarga@cisco.com>
Tue, 25 Oct 2016 16:04:37 +0000 (18:04 +0200)
committerAnil Belur <abelur@linuxfoundation.org>
Sun, 30 Oct 2016 11:41:47 +0000 (11:41 +0000)
commit4e6f543113c39b77354c6ca6c573af4076a11524
treeddde82dbd940ebe323bc9de3f04bf6d5eed33c52
parent89a15d03fdc1fed74eca4b2cbd70de25bba50747
BUG-7025: make the parser tree immutable

This adds a post-processing phase, which walks the entire tree
and makes sure children are initialized to an ImmutableList.

This is essentially the same operation as running the tree
through org.antlr.v4.runtime.Parser.TrimToSizeListener, except
it also initializes empty lists to immutable collection and
uses a more efficient implementation for singletons.

Change-Id: I2cf484654158ce01bb9f7c2ac51a9866f88ae320
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit acba6c1723f31a8689812cf0bd6f058f688465d3)
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/YangStatementSourceImpl.java