How to determine which methods are used by the Java class

I need to provide a report on which APIs are used by our code, and which methods to call. For a Windows DLL, I would use "dumpbin / import" - is there an equivalent for a Java.class file?

javap seems to be the obvious place to search, but I can't find any options that seem to do what I need.

+3
source share
5 answers

javap -c class1 class2 ... | grep invoke

You will receive all the runtime calls. You must filter them out of your APIs and you will get calls to the imported methods.

You can also determine which imported fields are used:

javap -c class1 class2 ... | grep getstatic (search also putstatic, putfield, getfield)

+2

, - :

  • / "import x.y.Z " Z {}, x.y

  • jar script ( IDE, )

  • "The method xxx is undefined"

+1

Apache/Maven jxr?

0

, , , perl script, .

jar jad http://en.wikipedia.org/wiki/JAD_(JAva_Decompiler) , perl script, :

  • . import reg

    b ,  

    . ,

    . , + +.

, , - - - .

, , .

, , , (, , !).

ruby ​​/python/php/sed/awk perl, .

0

, ASM library

- Java. API vistor, , ( , / ).

0

Source: https://habr.com/ru/post/1745367/


All Articles