I would like to create a graph which contains Java classes of a program as nodes and the relationships between the classes as edges. How can I determine the relationships between classes? I thought about checking the import statements, but they are often inaccurate because of the * wildcard.
You are going to need a compiler.
Or look at compiled code.
Easiest kludgey way: Load the code and apply java.lang.reflect
(or a library which uses that).
The difficult way: Read the class files. Probably use one of the libraries which handles this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.