"hide empty methods" with --some line-- breaks class content

0 votes
asked Feb 4, 2015 in Bug by valexiev (1,000 points)
All the content of this class does not appear:
 
@startuml
 hide empty methods
 
 class agent as "ulan:{m}-agent" {
   a schema:Person    | Organization
   --from preferred Biography--
   schema:description
 }
@enduml
 
If I replace the second line with "show empty methods", the content does appear.
 
What do "empty methods" have to do with my line? First it's not empty (see "schema:description"), and second how did you decide that line indicates where the methods start? I could have 5 lines

 

1 Answer

0 votes
answered Feb 4, 2015 by plantuml (230,800 points)
selected Sep 20, 2019 by valexiev
 
Best answer

Ok, the keyword "empty methods" is very a bad choice. It does not mean "hide methods that are empty", it does mean : "in classes, hide areas that are supposed to contains methods, if this area is empty because the class has no methods".

Actually, "empty methods" makes only sense when used with classes that have fields and methods (like on regular programmation language : C++/Java/Php/C##), something like:

@startuml
class agent {
  int field
}
@enduml

 

@startuml
hide empty methods
class agent {
  int field
}
@enduml

PlantUML detects parenthesis to infer what is a field and what is a method.

In your example (call Advanced class body http://plantuml.com/classes.html#Body ) , you define your own areas with separators, so the "hide empty method" has no sense, and we should have ignored it. Somehow, this is a bug that we are going to fix.

Hope that things are more clear!

commented Feb 8, 2015 by valexiev (1,000 points)
Thanks for the explanation! I noticed that lines with parens go to a section below and now it makes sense they are treated as methods.

If I understand correctly, only the first section is treated as attribtutes, all the rest are treated as methods.

Fixing the bug will be much appreciated. Right now I need to have some empty sections in my diagram, lest I use the explicit method section "--from preferred Biography--".

Thanks for all your work!!!!!
commented Sep 20, 2019 by valexiev (1,000 points)

The diagram now works perfectly

...