| 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 | 6270f6f | 2015-02-18 15:49:02 +0000 | [diff] [blame] | 7 | [](https://gitter.im/javaparser/javaparser?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
| 8 |
|
| Nicholas Smith | 2b77f43 | 2015-02-23 11:01:28 +0000 | [diff] [blame] | 9 | [](https://travis-ci.org/javaparser/javaparser)
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 10 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 11 | ## Features
|
| 12 |
|
| 13 | * Light weight
|
| 14 | * Performant
|
| 15 | * Easy to use
|
| 16 | * Modifiable AST
|
| 17 | * Create AST from scratch
|
| 18 | * Support of comments
|
| 19 |
|
| 20 | ## Dependency Management
|
| 21 |
|
| 22 | The project binaries are available in Maven Central. Just add the following to your maven configuration or taylor to your own dependency management system.
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 23 |
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 24 | Current 1.8 Release
|
| 25 | ```xml
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 26 | <dependency>
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 27 | <groupId>com.github.javaparser</groupId>
|
| 28 | <artifactId>javaparser-core</artifactId>
|
| Nicholas Smith | 28d50d3 | 2015-05-19 10:05:26 +0100 | [diff] [blame] | 29 | <version>2.1.0</version>
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 30 | </dependency>
|
| Federico Tomassetti | 2051f04 | 2014-07-30 19:01:19 +0100 | [diff] [blame] | 31 | ```
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 32 |
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 33 | Final 1.7 Release
|
| 34 | ```xml
|
| 35 | <dependency>
|
| 36 | <groupId>com.google.code.javaparser</groupId>
|
| 37 | <artifactId>javaparser</artifactId>
|
| 38 | <version>1.0.11</version>
|
| 39 | </dependency>
|
| 40 | ```
|
| 41 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 42 | ## How To Compile Sources
|
| Nicholas Smith | 15a23ae | 2015-01-14 10:27:51 +0000 | [diff] [blame] | 43 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 44 | 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] | 45 |
|
| Federico Tomassetti | 2051f04 | 2014-07-30 19:01:19 +0100 | [diff] [blame] | 46 | ```
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 47 | mvn clean install
|
| Federico Tomassetti | 2051f04 | 2014-07-30 19:01:19 +0100 | [diff] [blame] | 48 | ```
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 49 |
|
| Nicholas Smith | 3e6e620 | 2015-01-20 14:24:25 +0000 | [diff] [blame] | 50 | 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] | 51 |
|
| 52 | ```
|
| 53 | mvn javacc:javacc
|
| 54 | ```
|
| 55 |
|
| 56 | ## Manual
|
| 57 |
|
| 58 | Examples of how to use the library can be found on the [Manual](https://github.com/javaparser/javaparser/wiki/Manual) page of the wiki
|
| 59 |
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 60 | ## Troubleshooting
|
| 61 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 62 | 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] | 63 |
|
| 64 | 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] | 65 |
|
| 66 | ## Javadoc
|
| 67 |
|
| Nicholas Smith | cd1296d | 2015-01-20 14:22:40 +0000 | [diff] [blame] | 68 | The libraries javadoc can be found [here](http://javaparser.github.io/javaparser/javadoc-current/)
|
| Federico Tomassetti | cf8d7b1 | 2014-07-30 19:00:26 +0100 | [diff] [blame] | 69 |
|
| 70 | ## History
|
| 71 |
|
| Didier Villevalois | d5e8843 | 2015-03-16 14:23:45 +0100 | [diff] [blame] | 72 | 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] | 73 |
|
| Didier Villevalois | d5e8843 | 2015-03-16 14:23:45 +0100 | [diff] [blame] | 74 | 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] | 75 |
|
| Federico Tomassetti | 43e1e41 | 2015-08-06 17:31:26 +0200 | [diff] [blame^] | 76 | ## Related projects
|
| 77 |
|
| 78 | From JavaParser other projects have been derived:
|
| 79 |
|
| 80 | * [Walkmod](http://walkmod.com/): a tool to automatically correct violations of code conventions
|
| 81 |
|
| 82 | ## Credits
|
| 83 |
|
| 84 | This project has been maintained thanks to the joint efforts of many contributors: we are extremely grateful to all of them.
|
| 85 |
|
| 86 | 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.
|
| 87 |
|
| Didier Villevalois | d5e8843 | 2015-03-16 14:23:45 +0100 | [diff] [blame] | 88 | ## License
|
| Nicholas Smith | 26c753d | 2015-01-14 10:02:55 +0000 | [diff] [blame] | 89 |
|
| Federico Tomassetti | ee6a48a | 2015-07-25 14:42:17 +0200 | [diff] [blame] | 90 | JavaParser is available either under the terms of the LGPL License or the Apacha License. You as the user are entitled to choose the terms under which adopt JavaParser.
|
| 91 |
|
| 92 | For details about the LGPL License please refer to [LICENSE.LGPL](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.LGPL).
|
| 93 |
|
| 94 | For details about the Apache License please refer to [LICENSE.APACHE](ttps://github.com/javaparser/javaparser/blob/master/LICENSE.APACHE).
|