Fog Creek Software
Discussion Board




a tool for displaying functioncalls within Java

Im about to tidy up a huge Java-project and is therefor searching for a tool documenting and displaying the functioncalls made within the source code. It would be nice if it had a graphical feedback aswell, showing a nice graph etc.

I want it as a way to discover which functions that are not used and which that are used by many other functions.
And as a bonus it would be great if all call-paths were shown.


An example:
---
lets say that function foo() calls functions bar1(), bar2() and bar3(). Lets also say that function bar2() calls bar3() and bar4().
And finally, the functions notCalled1() and notCalled2() are not called by any other functions.

What I want the tool todo, preferrably in a graphical way, is to display this information to me:

foo() --> bar1(), bar2(), bar3()
bar2() --> bar3(), bar4()

functions not called:
foo(), notCalled1(), notCalled2()

Did you follow and Is there any such tool?

Tommy Strom
Wednesday, February 11, 2004

Eclipse (www.eclipse.org) has a 'Call Heirarchy' function which works really well.

Richard
Wednesday, February 11, 2004

The hierarchy-tool doesnt tell me which functions that are never called.
But the call-hierarchy, from a given function, is shown very well. Thanks!

Tommy Strom
Wednesday, February 11, 2004

I recently was asked to look at an open-source Java app, and this might be applicable. The commenting is weak at best, with slim Javadoc detail. Variable & Class naming is good though.

What is generally the best way to get a feel for the architecture of an application?  I'd like to spend a day or two getting into it, understanding the flow of things.

I tried using the Omondo UML tool, but I was spending far too much time cursing at the auto-layout "feature".

Any suggestions?

I am using Eclipse as well, by the way.

Nigel
Wednesday, February 11, 2004

Eclipse allows you to search for all references to a given method. If there are no references to the method, then you know the method is never called.

This, however, will only work on a method by method basis and will not display any sort of heirarchy.

Eclipse also allows you the option of having it flag on a build unused fields and local variables but I don't think it does unused methods.

BTW, the Java terminology that is used is not "functions" but "methods".

Avrom Finkelstein
Wednesday, February 11, 2004

How do these tools work in the presense of virtual methods?  It seems to me that it would be very hard to give run-time information (what methods are called, and how often) based on compile-time analysis.  Obviously you can get *some* information, but are they really that good?

(If you can't tell, I've never used the tools in question.)

Brian
Wednesday, February 11, 2004

I think all methods in java are virtual....

vince
Friday, February 13, 2004

*  Recent Topics

*  Fog Creek Home