BUG-7025: make the parser tree immutable 44/47544/4
authorRobert Varga <rovarga@cisco.com>
Tue, 25 Oct 2016 16:04:37 +0000 (18:04 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 26 Oct 2016 09:46:08 +0000 (09:46 +0000)
commitacba6c1723f31a8689812cf0bd6f058f688465d3
treed34cf34c0bb2d7b5c4b11d33e86cf76e823b48e3
parent99710b7bb5d6251ec37648e179f2bb871e283808
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>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/YangStatementSourceImpl.java