Re: Export all classes in call graph?



Robert Mischke wrote:
With "call graph" I mean the set of all classes that may be directly
or indirectly used from classes you specify.

A call graph works on method-level, not class level (often, for the purpose of a call graph, constructors are also treated as methods). A call graph indicates which methods (of which classes) are used (are "called") by other methods, not just which classes somewhat dependent on each other.


You are probably after compile-time dependency or class dependency, not a call graph.

In the example below, B and C are in the call graph of A, while D is
not.

"in the call graph of A" has no meaning. You probably mean "children of A".

> In Java, the call graph can be easily found by following the
"import" statements, as long as they are accurate and don't use "*"s
(because this also includes classs that are not neccesarily in the
call graph).

This is absolutely wrong. Import statements introduce a compile-time dependency, but not necessarily a class dependency. And, if no method is used from the imported class, the imported class would also have no business in showing up in a call-graph.


	import A;

	/** never uses A **/
	class B {
		int ten() { return 10; }
	}

You can only compile this, when A is in the CLASSPATH (compile-time dependency), but you can change A as much as you like without having an influence on B (no class dependency). And since B uses nothing of A, no method of A would ever appear as a children of a method of B in a call-graph.

/Thomas

--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
.



Relevant Pages

  • Re: Observer pattern limitations
    ... dependency graph may depend on thousands of inputs, ... complete recurse of the graph is needed just to tell whether it is ... You refer to a notification propagation. ... and an observer decides that it wants to synchronously detach. ...
    (comp.object)
  • Re: Export all classes in call graph?
    ... Although the option to keep only classes with methods in the actual call graph would be nice, ... Dependency checking in Java source code is notorious, because you really have to parse the source code and apply the same rules as the Java compiler to figure out which classes are actually used. ...
    (comp.lang.java.programmer)
  • Re: Export all classes in call graph?
    ... What I actually meant was a class dependency ... with methods in the actual call graph would be nice, ... Import statements introduce a compile-time ... >business in showing up in a call-graph. ...
    (comp.lang.java.programmer)
  • Re: Dependency Queue
    ... priority queue except instead of a strict ordering of items by ... To date I've been generating a dependency graph in advance every ... I'd like a dynamic dependency queue for two reasons: ...
    (comp.lang.python)
  • Ruby Object Graph visualizer
    ... Any pointers to a tool to generate some type of object (dependency) ... graph, for Ruby classes or objects (perhaps reading ObjectSpace). ...
    (comp.lang.ruby)