plantUML cannot stack package containers

0 votes
asked Sep 7 in Bug by SchlauFuchs (120 points)
Given the source:

@startuml
package A
{
    package B
    {
        package C
        {
            package D
            {
                package E
                {
                    component "E1"
                    component "E2"
                    component "E3"
                }
            }
        }
    }
}
@enduml

the plantUML parser fails with

[From string(line 12))] [...] Use 'allow mixing' if you want to mix classes and other UML elements

This fails both in online plantUML as well as in IntelliJ plugin.

2 Answers

0 votes
answered Sep 7 by albert (1,990 points)

As noted in another discussion in this forum the spelling for 'allow mixing' is incorrect this should be 'allow_mixing', the following works with the current version for me, see http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuKhCoSalZy_DhCZCI-SgI4pEJanFLN3agkPI008OtmdCWuWXYpk3HH1owF8kS5646cpgN14o2BLOG79-Ra5-NcfUYOAIgw4IGIL6X9KOOogfvKBb8LWGifRB8JKl1HXs0000

@startuml
allow_mixing
package A
{
    package B
    {
        package C
        {
            package D
            {
                package E
                {
                    component "E1"
                    component "E2"
                    component "E3"
                }
            }
        }
    }
}
@enduml

commented Sep 8 by SchlauFuchs (120 points)
But why do I need allow mixing at all? Mixing is not intended.
commented Sep 8 by albert (1,990 points)
The comment says that you have to use "allow_mixing" when you want to mix classes and other UML elements and as far as I know "packages" are from class diagrams and "components" from component diagrams.
commented Sep 8 by SchlauFuchs (120 points)
If I look at http://plantuml.com/component-diagram section "Grouping Components", there is no mention of 'allow mixing' flag, and there are more container types to chose from. But actually, the parser seems not to accept the syntax with rund and square brackets.
commented Sep 8 by albert (1,990 points)
edited Sep 8 by albert
Did an experiment and it looks like the placing of the curly brackets '{' in respect to "package" is quite sensitive and that the "package" syntax is different for the different diagrams (?).

@plantuml can you shine a light on this issue?
0 votes
answered Sep 8 by albert (1,990 points)

Results from some experiments:

We don't need the 'allow_mixing':

@startuml
package "A" {
package "B" {
package "C" {
package "D" {
package "E" {
component "E1"
component "E2"
component "E3"
}
}
}
}
}
@enduml

See: http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuU8gI4pEJanFLL1oL5AeHl2SK7ZEA3mN59uhY9USdrkGdvUQLmBa6ogXS8rGkSPANBLmw92Qbm9q1G00

When placing the curly bracket '{' on the next line we need 'allow_mixing':

@startuml
allow_mixing
package "A"
{
package "B" {
package "C" {
package "D" {
package "E" {
component "E1"
component "E2"
component "E3"
}
}
}
}
}
@enduml

See: http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuKhCoSalZy_DhCZCI-SgI4pEJanFLL1oLEAgHl2Sb1IGUCueF1SKdYk8bvoVMv2VbvfN0kGRAg5mZL2vnafSjN3ea9gN0dGH0000

commented Sep 8 by SchlauFuchs (120 points)
that explains it, but it feels a bit buggy! Whitespace behavior of that kind needs either be documented or fixed.
...