devlauer / plantuml-generator

utility and maven plugin project for generating plantuml class diagrams and sequence diagrams out of java classes
https://devlauer.github.io/plantuml-generator/plantuml-generator/latest/index.html
Apache License 2.0
87 stars 26 forks source link

Does it support branching with if else? #168

Open chenhaoqiang opened 6 months ago

chenhaoqiang commented 6 months ago

Can a sequence diagram present the logical flow of if else? It will make it look clearer. Thank you for providing such a great plugin!

devlauer commented 6 months ago

Sorry for the delayed answer. Logical structures such as if/else are not currently supported in the sequence diagram. Since the currently used library javassist for analyzing the control-flow makes this somewhat difficult, I would have to take a look at other libraries such as asm or similar in this regard. So I can't say at the moment when such functionality will be available.

chenhaoqiang commented 6 months ago

Sorry for the delayed answer.

Logical structures such as if/else are not currently supported in the sequence diagram. Since the currently used library javassist for analyzing the control-flow makes this somewhat difficult, I would have to take a look at other libraries such as asm or similar in this regard. So I can't say at the moment when such functionality will be available.

Thank you for your response! I would really appreciate having this feature to achieve the goal of code as documentation. I know there is a library called javaparser (https://github.com/javaparser/javaparser), and I'm wondering if it can be helpful to you? Additionally, I would like to display method comments in sequence diagrams instead of directly using method names, and I hope this can be a configurable option. As far as I know, the javaparser library is capable of parsing comments. Thank you again for your efforts!

devlauer commented 5 months ago

Bytecode is currently used for sequence analysis, as this offers greater flexibility, even across library boundaries. This would be different with JavaParser as far as I can see at first glance. But I'll take a closer look at it when I get the chance to see whether I can implement it as desired. Unfortunately, I only have very little time at the moment, so it will probably take some time.

chenhaoqiang commented 5 months ago

Bytecode is currently used for sequence analysis, as this offers greater flexibility, even across library boundaries. This would be different with JavaParser as far as I can see at first glance. But I'll take a closer look at it when I get the chance to see whether I can implement it as desired. Unfortunately, I only have very little time at the moment, so it will probably take some time.

Thank you for your reply. I'm really excited about this feature! Please plan and develop this functionality at your own pace.

Maxouwell commented 3 months ago

Hi @devlauer, I'm willing to look into it, and maybe do a PR, first with iso fonctionnality, and then mainly to try adding control flow to the diagram. What tool would you want to support, ASM ou JavaParser ?

devlauer commented 1 month ago

Hi @Maxouwell, Thank you for your offered help. Personally, I would prefer ASM because it works with bytecode and you can also create diagrams for classes for which no source code is available. However, this would not allow the desired display of comments from the source code to be implemented. The solution should therefore enable a configurable exchange of the parser so that JavaParser can also be used as an alternative later on.