shuzijun / plantuml-parser

Convert the Java(or kotlin) source code to Plantuml
https://plugins.jetbrains.com/plugin/15524-plantuml-parser
Apache License 2.0
113 stars 27 forks source link

UML can't be rendered bc plugin generates attached `note top of..` after the relevant object. #28

Closed fromSmolsoft closed 7 months ago

fromSmolsoft commented 7 months ago

Describe the bug Plugin generates attached note after the relevant object. As result, instead of diagrams only green text is rendered and "syntax" warning is reported at closing tag end note saying " "
A clear and concise description of what the bug is.

This is what plugin generates and it doesn't get rendered properly;

'this the object
class com.example.app.ui.MainActivity{
}
'the note with syntax warning
note top of com.example.app.ui.MainActivity
 Comets from java code are shown here.
end note

This is how it can be fixed by switching positions of ;

'the note with syntax warning
note top of com.example.app.ui.MainActivity
 Comets from java code are shown here.
end note

'this the object
class com.example.app.ui.MainActivity{
}
'the note with syntax warning
note top of com.example.app.ui.MainActivity
 Comets from java code are shown here.
end note

To Reproduce Steps to reproduce the behavior:

  1. Go to Project tree
  2. Right click on any packages that includes multiple sub-packages and/or classes with comments / javadocs
  3. click PlantUML parser and generate uml
  4. Open generated uml in Intellij / Android Studio rendered view
  5. Instead of diagrams , there's only green text and uml code reports systax error at first problematic note top of... note end Note: Only some of the notes are generated this (incorrect) way.

Software versions(Help -> About)

If i misunderstood the functionally accept my apology and feel free to close the issue.

shuzijun commented 7 months ago
image

I have tested the provided content and it can be displayed normally. Can you provide the source code for generating UML?

fromSmolsoft commented 7 months ago

image I have tested the provided content and it can be displayed normally. Can you provide the source code for generating UML?

I can't provide full project source but i tracked the issue into specific class.

Bellow is the code snippet how the uml is generated from the class - notice the note not being on it's own line. It causes all the following notes to get the syntax warning i described before.

'Rest of the uml code...

class com.example.module_name.game.Calculator {
+ {static} int[] calculate(int,int,String)
}note left of com.example.module_name.game.Calculator::calculate(int,int,String)

     * Calculates the result of a math operation.
     * @return array where<p> int[0] = math result<p> int [1] = reminder of math operation

end note

'Rest of the uml code...

This is how the class looks like in Java.

public class Calculator {

    /**
     * Calculates the result of a math operation.
     * @return array where<p> int[0] = math result<p> int [1] = reminder of math operation
     */
    public static int[] calculate(int num1, int num2, String operator) {
         // some code...
        return result;
    }
}