0

I'm trying to code some analysis on our complex multi-module projects to simplify them. Maven's dependency analyzer can list the transitive undeclared dependencies. I'm aware that IDEA can generate a graph, but that's not what I'm after. The code base is large and I want to do custom filters and actually want to learn more on how things work.

My thinking is that since javap -c gives a nice enough output for a single .class file to see which classes are referenced, I was thinking what is the proper way to invoke similar functionality programatically? I looked at libraries like Javaassist, BCEL, Asm but was not sure if they are the proper tools to use so any advice and direction would be nice. I'm only after the referenced classes only.

Mustafa
  • 10,013
  • 10
  • 70
  • 116
  • What exactly are you trying to achieve? Why do you need to look into .class files? Don't you have all the sources? – ACV Dec 23 '20 at 16:49
  • Have a look at this question https://stackoverflow.com/questions/65285705/how-can-i-identify-classes-which-will-be-used-in-java-class-file and the suggestions in Holger's comment. – terrorrussia-keeps-killing Dec 23 '20 at 19:26
  • @ACV some sources requires additional process. Tiny problem is that there might be import x.* and without compiling its requires more knowledge to know whereas .class file has that info ready. Additionally, I also want to look at some jar files, yes some sources are not there. – Mustafa Dec 23 '20 at 20:43
  • @fluffy The one with the javaassit seems to work great, thanks for the pointer. I searched but could not find that :( – Mustafa Dec 23 '20 at 20:47

0 Answers0