Using IntelliJ IDEA Diagrams to Visualize Java Servlet Inheritance Hierarchy
This article demonstrates how to use IntelliJ IDEA's diagram feature to view, clean up, and explore the inheritance and interface implementation relationships of Java Servlet classes, including tips for filtering classes, inspecting members, zooming, and adding additional classes to the diagram.
Recently I had some free time, so I revisited past knowledge, especially the Servlet part where I previously struggled to remember the inheritance and interface implementation hierarchy. Using IntelliJ IDEA's diagram feature made everything clear, and I’m sharing the experience.
1. View the inheritance chain in graphical form
In the class tab you want to inspect, right‑click and choose Diagrams ; you can select Show to open the diagram in a new tab or Show … Popup to display it as a floating window.
You can also right‑click the class directly in the project tree and choose Diagrams for the same result.
The resulting diagram (example shown for a custom Servlet) displays inheritance with solid blue arrows and interface implementation with dashed green arrows.
2. Optimize the inheritance diagram to suit your needs
2.1 Remove irrelevant classes
If the diagram contains classes you don’t care about (e.g., Object or Serializable ), select them and press the Delete key. After cleaning, the diagram shows only the important relationships.
2.2 Show detailed class information
Right‑click the diagram and choose Show Categories to expand attributes, methods, constructors, etc., or use the toolbar button for the same purpose.
The diagram then displays the selected members. You can further filter by visibility (e.g., show only protected and higher) via Change Visibility Level .
2.3 Zoom and improve readability
Press the Alt key to activate a magnifying glass for easier viewing of small diagrams.
2.4 Add other classes to the diagram
To examine relationships with additional classes, right‑click the diagram, choose Add Class to Diagram , and type the class name.
For example, adding a Student class shows no connecting arrows, indicating no direct inheritance or interface relationship with the current classes.
2.5 Jump to source code
Double‑click a class in the diagram, then right‑click a method and select Jump to Source to open the method’s implementation.
Using the Structure tool on the left side lists all methods of the selected class; clicking a method scrolls the editor to that method.
3. Conclusion
Leveraging IntelliJ IDEA’s diagram, visibility, and navigation features makes exploring class relationships and studying framework source code a comfortable and efficient experience.
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.