plantuml-generator icon indicating copy to clipboard operation
plantuml-generator copied to clipboard

Does it support branching with if else?

Open chenhaoqiang opened this issue 1 year ago • 6 comments

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!

chenhaoqiang avatar Apr 01 '24 12:04 chenhaoqiang

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.

devlauer avatar Apr 07 '24 19:04 devlauer

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!

chenhaoqiang avatar Apr 08 '24 12:04 chenhaoqiang

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.

devlauer avatar Apr 14 '24 16:04 devlauer

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.

chenhaoqiang avatar Apr 14 '24 17:04 chenhaoqiang

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 ?

Maxouwell avatar Jul 02 '24 10:07 Maxouwell

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.

devlauer avatar Aug 18 '24 13:08 devlauer