TreeElement (TreeElement first, ASTNode last, ASTNode anchor, Boolean before) { if (anchor == null){ if (before == null || before.booleanValue()){ anchor = findChildByRole(ChildRole.RBRACE); before = Boolean.TRUE; } else{ anchor = findChildByRole(ChildRole.LBRACE); before = Boolean.FALSE; } } final TreeElement firstAdded = super.addInternal(first, last, anchor, before); if (ElementType.EXPRESSION_BIT_SET.contains(first.getElementType())) { final CharTable charTab = SharedImplUtil.findCharTableByTree(this); for (ASTNode child = first.getTreeNext(); child != null; child = child.getTreeNext()) { if (child.getElementType() == JavaTokenType.COMMA) break; if (ElementType.EXPRESSION_BIT_SET.contains(child.getElementType())) { TreeElement comma = Factory.createSingleLeafElement(JavaTokenType.COMMA, ",", 0, 1, charTab, getManager()); super.addInternal(comma, comma, first, Boolean.FALSE); break; } } for (ASTNode child = first.getTreePrev(); child != null; child = child.getTreePrev()) { if (child.getElementType() == JavaTokenType.COMMA) break; if (ElementType.EXPRESSION_BIT_SET.contains(child.getElementType())) { TreeElement comma = Factory.createSingleLeafElement(JavaTokenType.COMMA, ",", 0, 1, charTab, getManager()); super.addInternal(comma, comma, child, Boolean.FALSE); break; } } } return firstAdded; }