Homepage

Our goal is to build a simple and lightweight set of tools to generate, analyze, and process Java code.

All of this is offered under a business friendly license.

JavaParser is used in dozens of open-source and commercial projects.


Show your love adding one star more!
Star JavaParser

 Intellij IDEA licenses supplied by Jetbrains

What you can do with JavaParser

JavaParser is a set of tools to:

Java code.

Want to learn JavaParser?

We are writing a book on JavaParser and we need your feedback!

Help us understanding what is not clear, what should we add, share examples and ideas with us.
You can also contact us on gitter or on the book repository.

 

In the rest of the page we will look on different features of JavaParser. You may also be interested in checking out some presentations we gave about JavaParser.

Parsing Java code

Using JavaParser you can get an Abstract Syntax Tree (AST) from Java code. The AST is a structure representing your Java code in a way that it is easy to process:

Analyze Java code

Suppose you want to look for fields which are public and not static. This is pretty easy using JavaParser:

Transform Java code

Maybe you want to ensure all abstract classes have a name starting with Abstract:

Generate Java code

Components of JavaParser

JavaParser is both the name of the set of tools and of the main component: the parser. In addition to JavaParser there is another component in the set of tools: JavaSymbolSolver.

The parser is extra lightweight (no dependencies at all!) and can give you super fast an AST for your Java code. Sometimes an AST is not enough because you want:

  • Understand to which element a certain name refer: a field? A variable?
  • You need to know the type of a complex expression
  • You want to get a list of all the interfaces implemented (also indirectly) by a certain class

JavaSymbolSolver does the extra work to answer this questions for you.

License

JavaParser is available either under the terms of the LGPL License or the Apache License. You as the user are entitled to choose the terms under which adopt JavaParser.

For details about the LGPL License please refer to LICENSE.LGPL.

For details about the Apache License please refer to LICENSE.APACHE.