Extracting class usage from Java methods using ctags

I would like to know if ctags can be used to extract classes from Java methods. So far, I could only use it to get a list of methods and instance variables, but not with the classes that are used in the methods.

eg.

 ... public void doSomething(MyClass myClassInst) { int someVar = myClassInst.getSomeVar(); System.out.println("Some var is " + someVar); } ... 

Currently, all I get is recognition of the method declaration. But I would like to extract that doSomething also uses the MyClass and System classes, not only to parse the text, but also to know the full class address, including the package ( java.lang.System and com.mypackage.MyClass ).

To be able to retrieve such metadata, ctags must have access to the abstract syntax tree compiler, and I'm not sure if it does it or just parses the source code.

Is there a way to accomplish what I'm trying to do with ctags, or does it outshine the scope of its functions?

+6
source share
1 answer

You can use asm or BCEL to achieve this.

+1
source

All Articles