I want to make a java application that takes java source codes as input to create and visit their Abstract Syntax Trees, so I can make some statistics out of them.
I found this java parser: https://github.com/javaparser/javaparser
My questions are:
I am not sure about NetBeans but you can create a project using maven or gradle and specify a dependency to JavaParser and you are done. It is that easy. Alternatively you may want to download the JavaParser jar from Maven central: it should not have any dependency so that would be enough.
Disclaimer: I am a contributor to JavaParser
Some years ago I've done a prototype to analyze Java source. I used this library Recoder (manual) that do the dirty work for me (parsing and building a good designed AST).
It's a jar so you can use it with any kind of IDE.
Usually I use Eclispe as Java IDE. It has its own AST model and you can consider to use Eclipse JDT Eclipse JDT .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.