| Nicholas Smith | 646793d | 2015-01-20 14:53:07 +0000 | [diff] [blame] | 1 | ## Java Parser and Abstract Syntax Tree
|
| matozoid | 2cab70d | 2013-09-16 13:31:33 +0200 | [diff] [blame] | 2 |
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 3 | This package contains a Java 1.8 Parser with AST generation and visitor support.
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 4 |
|
| 5 | The AST records the source code structure, javadoc and comments. It is also possible to change the AST nodes or create new ones to modify the source code.
|
| matozoid | 2d4deca | 2011-10-30 14:35:59 +0100 | [diff] [blame] | 6 |
|
| Nicholas Smith | d7c5113 | 2015-09-02 13:14:42 +0100 | [diff] [blame] | 7 | [](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.javaparser%22%20AND%20a%3A%22javaparser-core%22)
|
| Nicholas Smith | 2b77f43 | 2015-02-23 11:01:28 +0000 | [diff] [blame] | 8 | [](https://travis-ci.org/javaparser/javaparser)
|
| Nicholas Smith | cc80fc1 | 2015-08-17 15:15:26 +0100 | [diff] [blame] | 9 | [](https://coveralls.io/github/javaparser/javaparser?branch=master)
|
| Nicholas Smith | d6a8098 | 2015-08-17 15:25:32 +0100 | [diff] [blame] | 10 | [](https://gitter.im/javaparser/javaparser?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
| Nicholas Smith | cc80fc1 | 2015-08-17 15:15:26 +0100 | [diff] [blame] | 11 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 12 | ## Features
|
| 13 |
|
| 14 | * Light weight
|
| 15 | * Performant
|
| 16 | * Easy to use
|
| 17 | * Modifiable AST
|
| 18 | * Create AST from scratch
|
| 19 | * Support of comments
|
| 20 |
|
| 21 | ## Dependency Management
|
| 22 |
|
| matozoid | 3c137e9 | 2016-04-06 19:37:37 +0200 | [diff] [blame] | 23 | The project binaries are available in Maven Central. Just add the following to your maven configuration or tailor to your own dependency management system.
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 24 |
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 25 | Current 1.8 Release
|
| Nicholas Smith | d7c5113 | 2015-09-02 13:14:42 +0100 | [diff] [blame] | 26 |
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 27 | ```xml
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 28 | <dependency>
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 29 | <groupId>com.github.javaparser</groupId>
|
| 30 | <artifactId>javaparser-core</artifactId>
|
| Danny van Bruggen | 72b09da | 2016-07-21 11:09:59 +0200 | [diff] [blame] | 31 | <version>2.5.1</version>
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 32 | </dependency>
|
| Federico Tomassetti | 2051f04 | 2014-07-30 19:01:19 +0100 | [diff] [blame] | 33 | ```
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 34 |
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 35 | Final 1.7 Release
|
| Nicholas Smith | d7c5113 | 2015-09-02 13:14:42 +0100 | [diff] [blame] | 36 |
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 37 | ```xml
|
| 38 | <dependency>
|
| 39 | <groupId>com.google.code.javaparser</groupId>
|
| 40 | <artifactId>javaparser</artifactId>
|
| 41 | <version>1.0.11</version>
|
| 42 | </dependency>
|
| 43 | ```
|
| 44 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 45 | ## How To Compile Sources
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 46 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 47 | If you have checkout the project from GitHub you can build the project with maven using:
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 48 |
|
| Federico Tomassetti | 2051f04 | 2014-07-30 19:01:19 +0100 | [diff] [blame] | 49 | ```
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 50 | mvn clean install
|
| Federico Tomassetti | 2051f04 | 2014-07-30 19:01:19 +0100 | [diff] [blame] | 51 | ```
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 52 |
|
| Nicholas Smith | 3e6e620 | 2015-01-20 14:24:25 +0000 | [diff] [blame] | 53 | If you checkout the sources and want to view the project in an IDE, it is best to generate the additional source files; otherwise you will get many compilation complaints in the IDE
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 54 |
|
| 55 | ```
|
| 56 | mvn javacc:javacc
|
| 57 | ```
|
| 58 |
|
| 59 | ## Manual
|
| 60 |
|
| 61 | Examples of how to use the library can be found on the [Manual](https://github.com/javaparser/javaparser/wiki/Manual) page of the wiki
|
| 62 |
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 63 | ## Troubleshooting
|
| 64 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 65 | In the first instance try the [wiki](https://github.com/javaparser/javaparser/wiki)
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 66 |
|
| 67 | In the second instance please feel free to open an [issue](https://github.com/javaparser/javaparser/issues).
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 68 |
|
| 69 | ## Javadoc
|
| 70 |
|
| Nicholas Smith | c86a9ff | 2015-08-12 13:20:26 +0100 | [diff] [blame] | 71 | The libraries javadoc can be found [here](http://www.javadoc.io/doc/com.github.javaparser/javaparser-core/)
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 72 |
|
| 73 | ## History
|
| 74 |
|
| Didier Villevalois | d5e8843 | 2015-03-16 14:23:45 +0100 | [diff] [blame] | 75 | This parser is based on work by Sreenivasa Viswanadha and Jรบlio Vilmar Gesser. The original project, now inactive, was originally hosted at [Google Code](http://code.google.com/p/javaparser/) and supported only parsing Java 1.5.
|
| matozoid | 2d4deca | 2011-10-30 14:35:59 +0100 | [diff] [blame] | 76 |
|
| Didier Villevalois | d5e8843 | 2015-03-16 14:23:45 +0100 | [diff] [blame] | 77 | The project now supports parsing Java 1.8 and aims to continue support for features in future versions of the Java language.
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 78 |
|
| Federico Tomassetti | 43e1e41 | 2015-08-06 17:31:26 +0200 | [diff] [blame] | 79 | ## Related projects
|
| 80 |
|
| Federico Tomassetti | 212fd3f | 2016-10-20 21:41:35 +0200 | [diff] [blame] | 81 | [JavaSymbolSolver](https://github.com/javaparser/javasymbolsolver) is a project from the same committers working on JavaParser.
|
| 82 | You can use it to calculate the type of JavaParser expressions and connecting references with their declarations.
|
| 83 |
|
| Federico Tomassetti | 43e1e41 | 2015-08-06 17:31:26 +0200 | [diff] [blame] | 84 | From JavaParser other projects have been derived:
|
| 85 |
|
| 86 | * [Walkmod](http://walkmod.com/): a tool to automatically correct violations of code conventions
|
| Edgar Espina | 1986cf8 | 2016-02-29 09:40:38 -0300 | [diff] [blame] | 87 | * [jooby spec](http://jooby.org/doc/spec): analyze and exports [jooby routes](http://jooby.org) to [raml](http://raml.org) and [Swagger](http://swagger.io)
|
| Federico Tomassetti | 43e1e41 | 2015-08-06 17:31:26 +0200 | [diff] [blame] | 88 |
|
| 89 | ## Credits
|
| 90 |
|
| 91 | This project has been maintained thanks to the joint efforts of many contributors: we are extremely grateful to all of them.
|
| 92 |
|
| 93 | In particular we are thankful to the contributions we received by the [Walkmod](http://walkmod.com/) project which permitted to finalize support for Java 8. The author granted us the permissions to release that code also under the Apache License and we have greatly appreciated that.
|
| 94 |
|
| Didier Villevalois | d5e8843 | 2015-03-16 14:23:45 +0100 | [diff] [blame] | 95 | ## License
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 96 |
|
| Federico Tomassetti | 2c7ba12 | 2015-08-12 08:06:33 +0200 | [diff] [blame] | 97 | 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.
|
| Federico Tomassetti | ee6a48a | 2015-07-25 14:42:17 +0200 | [diff] [blame] | 98 |
|
| 99 | For details about the LGPL License please refer to [LICENSE.LGPL](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.LGPL).
|
| 100 |
|
| 101 | For details about the Apache License please refer to [LICENSE.APACHE](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.APACHE).
|