Notes on fields when some fields have visibility modifiers causes an exception

0 votes
asked Feb 15, 2019 in Bug by Remco

While it is not in the official documentation, I found on the forum that it is possible to add notes to individual attributes. This is great and I use it a lot. I did find a problem with it. 

In particular, this:

@startuml

note right of TestAttrributeNote::attribute1
This is a note that breaks.
end note

class String{
}

class TestAttrributeNote {
 String attribute1
# attribute2 : String
}
@enduml

breaks.

If either both attributes are given a visibility modifier, or neither, it does work.

I traced the problem down to:

net.sourceforge.plantuml.MethodsOrFieldsArea:
private TextBlock getUBlock(final VisibilityModifier modifier, Url url) {
...

changing the definition of:

return new AbstractTextBlock() {

  public void drawU(UGraphic ug) {}

  @Override

  public Rectangle2D getInnerPosition(String member, StringBounder stringBounder,    InnerStrategy strategy) {

    return null;

   }

   public Dimension2D calculateDimension(StringBounder stringBounder) {

   return new Dimension2DDouble(1, 1);

   }

};

(Bold code added). The problem goes away. 
It only works with the long style notes though, and top or bottom don't work either. 

1 Answer

0 votes
answered Feb 22, 2019 by plantuml (294,960 points)
Thanks for the feeback.

This is fixed in last beta http://beta.plantuml.net/plantuml.jar

Tell us if it's not working for you.
...