Skip to content

Commit

Permalink
JENA-369: Correct handling for the case of union-of-one
Browse files Browse the repository at this point in the history
  • Loading branch information
afs committed Jun 25, 2017
1 parent 32e5f20 commit f9c0746
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,16 @@ public void visit(ElementData el) {

@Override
public void visit(ElementUnion el) {
if ( el.getElements().size() <= 1 ) {
// If this is an element of just one (or none), just do it in-place
if ( el.getElements().size() == 0 ) {
// If this is a union of zero elements, do nothing.
return ;
}

if ( el.getElements().size() == 0 ) {
// If this is a union of one elements, put in a {}-group
visitAsGroup(el.getElements().get(0));
return;
}

if ( UNION_MARKERS ) {
out.print("{");
Expand Down

0 comments on commit f9c0746

Please sign in to comment.