I'm interested in gathering some statistics over a large corpus of Java code that I have access to. Some statistics I'd be interested in might include how often certain methods/classes are used, how often certain packages are imported, and so on.
My first thought was to use javaparser, but that library only supports up through Java 1.5, and most of the code I have is in 1.6 or greater.
Is there a library that will give me an accurate AST from some Java code (ie. can I ask javac for it somehow?), or is there a better way of approaching this problem (examining the bytecode, perhaps)?