A Java 1-25 parser and abstract syntax tree library with advanced analysis capabilities for source code manipulation.
JavaParser is a library that parses Java source code from versions 1.0 to 25, constructing an abstract syntax tree (AST) for programmatic analysis and manipulation. It solves the problem of needing to read, understand, and transform Java code programmatically, enabling tools for static analysis, refactoring, and code generation. The library includes advanced functionalities like symbol resolution to link identifiers to their declarations.
Java developers and tool builders who need to analyze, generate, or modify Java source code programmatically, such as those building linters, refactoring tools, code generators, or custom static analysis frameworks.
Developers choose JavaParser for its comprehensive Java version support, accurate AST generation, and integrated symbol resolution, providing a reliable foundation for building sophisticated Java development tools without relying on external proprietary parsers.
Java 1-25 Parser and Abstract Syntax Tree for Java with advanced analysis functionalities.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports parsing Java source code from versions 1.0 through 25, ensuring compatibility with both legacy and modern codebases as stated in the key features.
Includes JavaSymbolSolver to resolve symbol references, linking identifiers to their declarations with type information, which is crucial for deep code analysis.
Allows direct modification of the AST for implementing refactoring, code generation, or automated fixes, enabling powerful tool-building capabilities.
Provides optional JSON serialization of the AST via a separate module (javaparser-core-serialization), facilitating storage, transmission, or integration with external tools.
The README advises referring to the Migration Guide when upgrading from 2.5.1 to 3.0.0+, indicating that major version updates can introduce incompatible changes that disrupt existing tools.
Advanced features like symbol resolution require additional dependencies (e.g., javaparser-symbol-solver-core), and building from source involves multiple Maven commands and scripts, which can be cumbersome.
Generating a detailed AST and resolving symbols can be resource-heavy, making it less suitable for performance-critical applications or large-scale batch processing without optimization.