I’d like to generate a list of Java class dependencies, similar to Ant’s depend task, without the limitations listed at the bottom of the aforementioned page.
Are there any decent source-code dependency analyzers for Java? I’ve tried writing my own but resolving references is very complicated.
UPDATE: I’d like to reuse the algorithm in my open-source project. Please provide libraries which are open-source compatible.
Our DMS Software Reengineering Toolkit and its Java Front End can parse and name-resolve Java through 1.6 from just the source code. (It parses 1.7 but doesn’t name resolve some very dark corners, to be implemented Very Soon). It will use class files if you allow it. This provides a full AST and symbol tables. The DMS machinery will let you visit/inspect the ASTs and symbol tables.
From the symbol table data and the specific list of files of interest, you could compute the dependencies only using source code.
Yes, writing a name resolver is complex. Our team has more than a year invested in it, and still more to do.