Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I generate Diagrams and UML of Kotlin code?

How do I generate UML and diagrams for Kotlin code? I don't think getting the paid version of Intellij is an option for me. I have been trying Intellij plugins and I haven't found anything that works yet.

I would like to generate the diagrams and uml from the Kotlin code I have already written. A tool like this would save me a lot of time.

Thanks

like image 547
Philip Nguyen Avatar asked Nov 16 '17 15:11

Philip Nguyen


People also ask

How code is generated in UML?

To generate/update source files from UML package, perform any of the steps below: Right click on the package in any diagram and select Update to Code from the popup menu. Right click on the package under Diagram Navigator/Model Explorer/Class Repository and select Update to Code from the popup menu.

How do you create a class diagram for coding?

In the Project tool window, right-click a package for which you want to create a diagram and select Diagrams | Show Diagram Ctrl+Alt+Shift+U ). In the list that opens, select Java Class Diagram. IntelliJ IDEA generates a UML diagram for classes and their dependencies.

Can IntelliJ generate UML?

IntelliJ IDEA Ultimate allows you to generate UML diagrams. You can use ⌥⇧⌘U (macOS) or Ctrl+Alt+Shift+U (Windows/Linux) to generate a UML diagram for your code which can help you and your team to read and understand the codebase.


2 Answers

you can click only on a package in the project tree and click "Show Diagram...". Also it generates diagram from the Java point of view (shows Java's signatures and facade classes)

enter image description here

like image 142
Mehdi Ben Hamida Avatar answered Sep 17 '22 18:09

Mehdi Ben Hamida


May be it help others.

Currently, existing class diagram generator like SimpleUML(You can download it from android studio plugin repository) is not able to create class diagram of Kotlin class. But you can use this plugin for Kotlin with little more effort.

Open activity class in android studio.

Go to tool -> Kotlin -> Show Kotlin Bytecode. New side tab will open and show byte code of selected activity class.

Click on top decompile of generated Kotlin bytecode which generate className.decompile.java class.

Click on class name and then right click on mouse. In many options click on 'add to simpleUML diagram'. Create new or add diagram in existing file.

If you face problem, let me know.

Note: - If you will install SimpleUML then it may create issue. Make sure you download SimpleUMLCE for working in the best way.

like image 27
Sumit Kumar Avatar answered Sep 20 '22 18:09

Sumit Kumar