Closed luiscruz closed 7 years ago
Recent versions should be compatible with Python 3 (in addition to at least 2.7). You can traverse the AST by iterating any node including the root node returned by javalang.parse.parse
(see ast.py).
As for capabilities/limitations, javalang includes a (mostly) Java 8 compatible lexer and parser (Java 7 is fully supported, Java 8 has issues remaining). Also included is a basic Javadoc parser. This is sufficient for many things: extracting signatures/documentation, basic dependency analysis, etc. (see, for example, the https://github.com/bronto/javasphinx sister project), but insufficient for refactoring Java code.
In particular, there isn't support at the moment for writing an AST back out as Java source code. This functionality could be added relatively easily, but doing so in a way that also preserves formatting/layout would be more difficult.
More difficult is implementing all the Java language rules (beyond syntax) that are required to support refactoring. Take for example renaming a field, which must correctly understanding Java scoping and visibility rules to correctly distinguish a reference to a field from a reference to a local variable with the same name, or an inner class field with the same name.
Alright @c2nes ! Thanks 👍 This project is very interesting. I'll probably use it in future projects.
No problem and glad to hear it!
Hi everyone,
This project sounds really good. I have some questions that perhaps could be included in the ReadMe:
Thanks, Luis