hallvard / plantuml

Embed UML diagrams in files and view them in Eclipse
http://plantuml.sourceforge.net/
209 stars 57 forks source link

Inconsistancy in handling enum within Project Class Diagram #30

Closed damienwojtowicz closed 7 years ago

damienwojtowicz commented 7 years ago

I noticed that enum management within Project Class Diagram is wrong. Enum seems to be considered as a class and its litterals as unary associations.

Here is an example:

package misc;
public enum Jour {
    LUNDI, 
    MARDI, 
    MERCREDI, 
    JEUDI, 
    VENDREDI, 
    SAMEDI, 
    DIMANCHE
}

Here is a snippet of the project class diagram:

bug

Here is the generated PlantUML code:

enum Jour [[/MyProject/src/misc/Jour.java]] {
}
class Jour [[/MyProject/src/misc/Jour.java]] {
}
Jour --> "1" Jour : LUNDI
class Jour [[/MyProject/src/misc/Jour.java]] {
}
Jour --> "1" Jour : MARDI
class Jour [[/MyProject/src/misc/Jour.java]] {
}
Jour --> "1" Jour : MERCREDI
class Jour [[/MyProject/src/misc/Jour.java]] {
}
Jour --> "1" Jour : JEUDI
class Jour [[/MyProject/src/misc/Jour.java]] {
}
Jour --> "1" Jour : VENDREDI
class Jour [[/MyProject/src/misc/Jour.java]] {
}
Jour --> "1" Jour : SAMEDI
class Jour [[/MyProject/src/misc/Jour.java]] {
}
Jour --> "1" Jour : DIMANCHE

This is obviously a problem occuring in PlantUML Project Class Diagram View, since "simple" PlantUML view shows the following enum, which is correct: jour

hallvard commented 7 years ago

The code that generates associations didn't check that the field is an enum, for which associations shouldn't be generated. The ordinary PlantUML view doesn't try to show associations to other classes, so it wasn't hit by the bug.