Generating class and method references

A

alejandrina

Hi all,

We would like to know the classes and methods that are called from
each class/method in our source base. One way is to insert @link tags
or @see tags, then generate javadoc, but is there an automatic way or
a better way (meaning javadoc is not a requirement)? We are using
Eclipse; I have not found a plugin that does this, but maybe I missed
the right one :)

Thanks,

Alejandrina
 
A

alejandrina

Hi all,

We would like to know the classes and methods that are called from
each class/method in our source base. One way is to insert @link tags
or @see tags, then generate javadoc, but is there an automatic way or
a better way (meaning javadoc is not a requirement)? We are using
Eclipse; I have not found a plugin that does this, but maybe I missed
the right one :)

Thanks,

Alejandrina


Another solution would be some sort of "call hierarchy" tool that can
provide a complete call tree for a given class (or a whole project...)
with the ability to save the results to some file. Any ideas?

Alejandrina
 
D

Daniel Pitts

alejandrina said:
Another solution would be some sort of "call hierarchy" tool that can
provide a complete call tree for a given class (or a whole project...)
with the ability to save the results to some file. Any ideas?

Alejandrina
What you're asking for falls under "static analysis". I don't know if
you'll find anything, but googling for it might help.

Certain tools (I use Intellij IDEA) will let you search for uses of a
particular method. I don't know if that is good enough for your actual
need (as you haven't specified what you're goal is).

The hard thing is that it can only include calls from code that you
provide. If someone else uses your code from a different source tree,
you're out of luck.
 
A

Andrea Francia

With Netbeans you can search usages of a class or method simply with
right click -> Find Usages. I don't know if there is a similar function
in Eclipse.
 
A

alejandrina

With Netbeans you can search usages of a class or method simply with
right click -> Find Usages. I don't know if there is a similar function
in Eclipse.

Actually there is a nifty Call Hierarchy plugin that does both ways
(who does this method call and who calls this method). This is not
sufficient, however: what I am looking for is a tool that does this
for (at a minimum) all the methods in a class and lets me export the
results to (for example) a text file or XML file or whatever.

Does anyone know if such a tool exists?

Thanks,

Alejandrina
 
L

Larry A Barowski

alejandrina said:
Hi all,

We would like to know the classes and methods that are called from
each class/method in our source base. One way is to insert @link tags
or @see tags, then generate javadoc, but is there an automatic way or
a better way (meaning javadoc is not a requirement)? We are using
Eclipse; I have not found a plugin that does this, but maybe I missed
the right one :)

If you want to roll your own, it is much easier to do this
for compiled classes rather than source. A minimal class
file scanner (all you need are class references from the
constant pool) is very simple. I would guess that you can
create your own tool in less time than you will spend
searching for one, and yours will do exactly what you
want in exactly the way you want.
 
Z

Zig

Hi all,

We would like to know the classes and methods that are called from
each class/method in our source base. One way is to insert @link tags
or @see tags, then generate javadoc, but is there an automatic way or
a better way (meaning javadoc is not a requirement)? We are using
Eclipse; I have not found a plugin that does this, but maybe I missed
the right one :)

Thanks,

Alejandrina

The "universal" way:
1) Rename your method
2) Recompile
3) See what blows up

The Eclipse way:
1) Click on the the method in source code
2) Ctrl+Shift+G

HTH,

-Zig
 
A

alejandrina

The "universal" way:
1) Rename your method
2) Recompile
3) See what blows up

The Eclipse way:
1) Click on the the method in source code
2) Ctrl+Shift+G

HTH,

-Zig

Thanks, but I need a tool that does this FOR ALL THE CLASSES IN A
PROJECT, not one Ctrl-Shift-G at a time. It is clear that Eclipse
knows this, but I don't know how to extract it in "report" form.

Alejandrina
 
A

alejandrina

If you want to roll your own, it is much easier to do this
for compiled classes rather than source. A minimal class
file scanner (all you need are class references from the
constant pool) is very simple. I would guess that you can
create your own tool in less time than you will spend
searching for one, and yours will do exactly what you
want in exactly the way you want.
Intriguing...All I need now is some free time to do this :)

Thanks, I learned something new thanks to you

Alejandrina
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top