I have a Java project that I\'ve been working on for a while. The design started out pretty good but slowly degraded as changes were made. I\'m looking for some sort of to
Many tools are available for this, depending on the size of your system. The grandaddy of them all is Structure101, a commercial product.
http://structure101.com
I've used this on some big projects - it's complex but easily the most comprehensive of all the tools I know. It can graph a huge architecture, and lets you untangle some complex stuff. It has a sister product called reStructure101 where you can do what-if scenarios.
A nice competitor is Stan4j. It's nowhere near as complete, but does some stuff better, particularly showing the dependency context at the class level.
http://www.stan4j.com
(I own both products, but have no commercial affiliation with either)
Another way of viewing complex dependencies, particularly at the project level, is a Dependency Structure Matrix (DSM). Although S101 can do a DSM, Lattix has more support - it can handle Spring and Hibernate dependencies:
http://lattix.com/
(I've not used lattix - they make it too hard to evaluate it, which is bizarre because I work on some very big systems)
If your software is fairly small, and you are more interested in the simple class level, then something like Architexa may help you understand the structure better:
http://www.architexa.com/
Finally, if you want to roll your own, you can easily do this with ASM. It even includes a dependency matrix tool which tracks at the package level:
http://asm.ow2.org/doc/tutorial-asm-2.0.html (see down the page for the nify dependency matrix)
Here's the source for it - it's very simple, but clever. It works off bytecodes. http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/asm/asm/examples/dependencies/src/org/objectweb/asm/depend/