I defined a Tree node class from org.antlr.Runtime.Tree.CommonTree, say MyTree. When I add a MyTree object as a child to another tree object, the MyTree node is not actually added.
The problem is that I didn't override Tree.isNil() method. When Tree.addChild() is called, it check to see if the node is an imaginary node by isNil(). If it is and it has no children, the tree node will not be added.
After forcing MyTree.isNil() to return true, the MyTree object can be added as a child.
Reference: http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1tree_1_1_base_tree.html#ffa585d68d73d750699da8fb311226b2