Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

[BUG] Connector unexpectedly changes diagram type

0 votes

While working on my class diagrams, I noticed that all the icons in the generated image were changing to something completely different unexpectedly. Consider this example:

@startuml
interface Entity
interface SubEntity
Entity *-- SubEntity
@enduml
 
The diagram above is generated correctly, but I was able to narrow down the problem to the following line, if we change the star * for the "o" letter:
 
Entity o-- SubEntity
 
Instead of only changing the class diagram connector from composition to aggregation (i.e. solid to hollow diamond), all the shapes in the diagram change to something else entirely --circle shapes.
 
I was able to work around the problem by re-adding the interface qualifier when the connector is about to be added:
 
interface Entity o-- interface SubEntity
 
Since there's a workaround, this is not urgent or anything, but it's something worth addressing. Regards.
asked Feb 28 in bug by anonymous
edited Feb 28

1 Answer

0 votes

Hello,

The diagram type change. Here is a workaround to set the diagram type to class instead of component:

@startuml
class aaa
hide aaa
interface Entity
interface SubEntity
Entity *-- SubEntity
@enduml
 
It would be nice to have a skinparam (or somemthing else) to force the diagram type.
answered Feb 28 by Serge Wenger Work (1,860 points)
I tested that, but it didn't work. Notice that, in my original diagram example, I'm specifically using the o-- and not the *-- connector as you're using in your example.

After changing your *-- into my o-- I get:  java.lang.IllegalArgumentException newtype=ENTITY
Ok, here we have a nice bug!
We're going to fix it.
Thanks for the report.
Sorry the workaround was :
@startuml
class aaa
hide aaa
interface "Entity" as E
interface "SubEntity" as SE
E o-- SE
@enduml
I think I should note that the small test case I provided was simply a part of a much larger diagram that already had other interfaces and classes defined in it. The fact that other classes already existed in the larger diagram was not enough to "force" or prevent the diagram type from changing, which seems to be the intention of defining and hiding a class in this case.
This is not easy to fix.
It's due to the fact that "entity" is a keyword (not very documented, through...)
For example, you can have:
@startuml
Entity foo1
Class class2
@enduml

As you have guessed, the parser is confused between class diagram and component diagram.
We are still investigating this...
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...