How can I load a .java file into a CompilationUnit? For example, lets say I have a A.java file in my current project. I would like to load it into a CompilationUnit and then pass it to the ASTParser. It is not an option just to load it as a plain text since it seems that in that case I will not get the binding information in the AST.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You can load the projects using
jdt
andeclipse core
libraries.Using the following code you can load all the projects in the workspace.
Then you can get packages and in turn the java files.
Then you can use this ICompilationUnit object for getting the CompilationUnit
This CompilationUnit object can be passed on to the ASTParser.