I would like to know if it is possible to use ctags
to extract class usage from within Java methods. So far, I was able to only use it to get a listing of methods and instance variables but not which classes are utilized within methods.
E.g.
...
public void doSomething(MyClass myClassInst) {
int someVar = myClassInst.getSomeVar();
System.out.println("Some var is " + someVar);
}
...
Right now all I get is a recognition of the method declaration. But I would like to extract that doSomething
is also utilizing the classes MyClass
and System
but not just to parse the text but also know the full class address including the package (java.lang.System
and com.mypackage.MyClass
).
In order to be able to extract this kind of metadata, ctags would need to have access to the compiler's abstract syntax tree
and I am not sure if it does that or it simply does text parsing of the source code.
Is there a way to accomplish what I am trying to do using ctags or does it eclipse the scope of its functionality?
You can use asm or BCEL to achieve this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With