How do I generate Diagrams and UML of Kotlin code?

15,704

Solution 1

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

Solution 2

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.

Share:
15,704
Philip Nguyen
Author by

Philip Nguyen

Updated on June 02, 2022

Comments

  • Philip Nguyen
    Philip Nguyen almost 2 years

    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