This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
There are a couple tools that do that (sorry don't have links right now) by observing a running system. I think they do an AOP-like modification at class load time to log all method entry and exit points. I played with one and wasn't too thrilled with the output.
This is pretty well impossible with static source code analysis because we can't tell what implementation classes might be involved at runtime.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
See http://www.reversejava.com for a dynamic reverse engineering application which generates UML Sequence diagram and view of Participating Class diagram from any Java Application at runtime
All you have to do is just run your application and sit back. Reverse Java runs in background tracing all the activities happening inside your application and creates UML diagram for you.
This tool helps you to reverse engineer UML Sequence Diagram for your java program at runtime. It works well with both complex java programs (that have multiple threads) and J2EE applications deployed on Application Servers.
Check it out its very lightweight and easy to use.
Sequence diagram reverse of java method is available with:
Omondo EclipseUML. You can try the evaluation license if the need is just to reverse and see. Dagram sometimes messy but you can move, delete, change order etc...so you can work on your sequence diagram even once the reverse has been done. http://www.omondo-internal-build.com/eclipse-java-galileo-SR2-win32_eclipseUML2.2_package.zip Just unzip and it works.
Rational IBM : Very nice sequence diagram reverse. Clean job but after the diagram is fixed. You can not move frame etc...to change it.
Togethersoft: Not bad
eUML studio edition: buggy and paid feature. Would recommend only to my worst enemies :-)
This is a very old post, but because it keeps coming up in Google search results, I am replying now so that it can be useful for any future visitors.
MaintainJ is by far the best tool when it comes to generating the sequence diagrams for Java applications. The quickest way understand the tool's capabilities is to view the demo video. The demo is recorded on a large application with 8000+ classes.
1. It generates the runtime sequence and class diagrams for a single use case.
2. The sequence diagrams are easy to explore with simple user interface. You would not be looking at a 5000 call sequence diagram. Instead, you will initially be presented with a few calls, which you will expand depending on what interests you.
3. The sequence diagrams show the call context - the values of the arguments, return values and state of the called object
4. The sequence diagrams also show the actual runtime SQL calls made during the use case. This feature works regardless of the database framework used. The SQL statements are populated with the runtime parameters passed.
5. You can generate the end-to-end sequence diagram of a request that flows through multiple JVMs. So, if you have a web application calling a web service on another machine, you can generate an end-to-end sequence diagram.
6. You can export the diagrams into UML2 format and import them into RSA (Rational Software Architect) though you would be losing the above benefits like call context, SQL statements and the dynamic sequence diagram. The main idea is to enhance the model in RSA and probably to generate the source code.
7. MaintainJ provides many ways to filter out unwanted details from the diagrams. You can generate the sequence diagrams to include just your application classes and then apply some predefined filters on the diagrams to view just the business tier classes or just the web tier classes.
8. It also allows searching for a class or method or SQL statement across trace files. What this means is, you can easily find all the use cases that depend on a class or method or a database table or field.
9. It works on all kinds of Java applications. It provides out-of-the-box wizards for the most typical runtime configurations, but with a few changes to the application classpath and JVM arguments, it will work for any Java application.
10. It integrates seamlessly with JUnit. So, you can generate a sequence diagram for every test case and check the sequence diagram for any quick troubleshooting later.
I am the author MaintainJ. So, I could be biased in my statement that it is by far the best tool currently available in the market. I will be very interested to know if any other tool matches these capabilities. It is a commercial tool, but if you like to tool but cannot pay at the moment, write to me at firstname.lastname@example.org and something can be worked out.