issues resolved
* Java 10 support is complete.
* BREAKING: Java language level support has changed to make Java 10 support possible.
Here's a little article about it
issues resolved
* Java 10's var
can now be parsed and will be turned into a VarType
node.
It can not be resolved yet.
* NodeList
now has a pretty complete set of ...First
and ...Last
methods.
Thanks stephenramthun !
issues resolved
* The Javadoc parser has received a lot of attention.
issues resolved
* Thanks to un0btanium for fixing the readme file!
issues resolved
* BREAKING: AssignExpr.Operator.AND
is now AssignExpr.Operator.BINARY_AND
.
* BREAKING: AssignExpr.Operator.OR
is now AssignExpr.Operator.BINARY_OR
.
* getPrimaryTypeName
and getPrimaryType
give access to the type that has the same name as the file it came from.
* Enums will now get their constants aligned vertically if there are more than five.
* You can now convert between AssignExpr.Operator
and AssignExpr.Operator
if you like.
issues resolved
* JavaSymbolSolver is now in the same project as JavaParser, meaning they get released together from now on.
* LexicalPreservingPrinter has had a big speed optimization.
issues resolved
* BREAKING: the very confusing constructor NodeList(Node)
(which sets the parent) was removed.
* To avoid using the int type for token kinds, use the new JavaToken.Kind
enum.
It can convert to and from the int kind.
issues resolved
* the module name is now set to com.github.javaparser.core
issues resolved
* toSomeType()
methods have been added for many types that give more functional access to a subtype.
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* SourceRoot is now silent by default - look at the Log class if you want to change that.
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* Unicode escapes (\u1234
) are now retained in the AST,
but they are now only allowed in comments, string and character literals, and identifiers.
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* The pretty printer now cleans up Javadoc comments.
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* A functional visitor API has been added. See PR 1195 for now.
* Build is working again on Windows thanks to Leonardo Herrera.
* The pretty printer now has an option to order imports, also thanks to Leonardo Herrera.
* Receiver parameters are now well-supported instead of being a hack. See issue 1194 for a description.
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* BETA: the below work on Java Symbol Solver is still ongoing.
issues resolved
* BETA: we're still doing work to integrate parts of Java Symbol Solver to simplify its API.
* VisitorMap
is joined by VisitorSet
and VisitorList
,
for when you want to store Node
s in collection but don't want its default equals/hascode behaviour
issues resolved
* BETA: we're doing work to integrate parts of Java Symbol Solver to simplify its API.
* JDK 9 will compile JavaParser now.
* An official sample Maven setup was added.
issues resolved
* Two visitors were added: NoCommentEqualsVisitor
and NoCommentHashCodeVisitor
-
as the name implies you can use these to compare nodes without considering comments.
Thanks Ryan Beckett!
* isSomeType()
methods have been added for many types that help avoid instanceof
.
* asSomeType()
methods have been added for many types that help avoid casting to that type.
* ifSomeType()
methods have been added for many types, giving a nice functional way of doing if-is-type-then-cast-to-type-then-use.
* The LexicalPreservingPrinter
had its API changed a little: setup and printing are now separate things,
so you don't have to drag an instance of LexicalPreservingPrinter
through your code anymore.
* traverseScope
was added to all nodes with a scope, so you can travel through the scope without tripping over (non-)optionality.
issues resolved
* BREAKING: We missed a Java 9 feature which is now on board: try with resources can now refer to a resource declared outside of the statement.
This means that the node type you get for those resources is now Expression
instead of VariableDeclarationExpr
.
For Java 8 and below you can simply cast it to VariableDeclarationExpr
again.
See also the Javadoc for TryStmt
.
* You can now inspect the AST by exporting it to XML, JSON, YAML, or a Graphviz's dot diagram, thanks to Ryan Beckett!
* GenericVisitorWithDefaults
and VoidVisitorWithDefaults
were added which function like empty visitors,
but all the visit methods call a default method by default.
* Annotation support was cleaned up, adding some obscure locations where you can have annotations.
* EnumDeclaration
regained its constructor builder methods. They were accidentally lost around 3.2.2.
* ArrayType
now has an origin
field which indicates in which position the array brackets were found.
issues resolved
* SourceZip
has been added.
Use it to read source code from jars or zip files.
Thank you @ryan-beckett !
* JavaCC was upgraded to 7.0.2
* A new option for the pretty printer was added.
You can now wrap-and-column-align parameters of method calls.
Thank you @tarilabs !
issues resolved
* Parsing a partial java file (like an expression or statement) no longer ignores trailing code.
* New memory saving option: turn off token list.
issues resolved
* VisitorMap
lets you override hashcode/equals for nodes when used as a key for a map.
issues resolved
* The token list is now mutable - see methods on JavaToken
.
This caused mild breakage - some fields have become Optional
.
issues resolved
* Breaking: TryStmt::tryBlock
and EnclosedExpr::inner
were optional for no good reason. Now they are required.
* You can now ask a JavaToken
for its category, which is useful for examining the token list or doing syntax highlighting or so.
* enum
and strictfp
can now be used as identifiers on lower Java versions.
issues resolved
* We're up to date with the latest Java 9 module system again.
issues resolved
* Node.replace(old, new)
was added, including property-specific X.replaceY(newY)
methods
Scrapped due to release problem.
issues resolved
* Added isInnerClass()
that checks if a ClassOrInterfaceDeclaration
is an inner class (note: this is different from a nested class!)
* @ryan-beckett contributed a huge Eclipse setup guide
issues resolved
* We now recover from some parse errors! Here is an article
issues resolved
* EmptyMemberDeclaration
is gone!
It was deprecated for a while because it it was in the AST, but doesn't have any meaning in a Java program.EmptyStmt
was also deprecated, but that has been reverted.
This node does have meaning.
issues resolved
* NodeWithCondition
was added on all nodes containing a condition.
* Lots of work on improving lexical preservation.
* If a file was parsed from a file system, you can now get path information etc. from CompilationUnit
* API BREAKING: every node now points to its start and end token.
Some of the API has started returning TokenRange
instead of Range
- you can call toRange
to get the old object type.
We may still change the naming of some of this code in the following month.
New style changelog, no more issue numbers, but a link:
issues resolved
and any notable changes:
* the new method Node.removeForced()
by removing it, or removing the first parent that is optional.
This is different from Node.remove()
, remove()
only tries to remove the node from the parent and fails if it can't.
* FieldAccessExpr.scope
is now a required property.
You might find some get()
s in your code that are no longer necessary.
* ReferenceType
no longer has a type parameter, so every ReferenceType<?>
can be replaced by ReferenceType
now.
Beta: TreeStructureVisitor
.
Beta: TreeStructureVisitor
.
The lexical preservation code is stable!
Beta: TreeStructureVisitor
.
This is the first version to parse Java 9.
Beta: TreeStructureVisitor
, and LexicalPreservingPrinter
.
Beta: TreeStructureVisitor
, and LexicalPreservingPrinter
.
A start has been made on source level support. The default level is Java 8.
It can be set to Java 9 like this for a parser instance:java private final JavaParser parser = new JavaParser(new ParserConfiguration().setValidator(new Java9Validator()));
and like this for the static parse methods:java JavaParser.getStaticConfiguration().setValidator(new Java9Validator());
Beta: TreeStructureVisitor
, ConcreteSyntaxModel
, and LexicalPreservingPrinter
.
Beta: TreeStructureVisitor
, ConcreteSyntaxModel
, and LexicalPreservingPrinter
.
GenericListVisitorAdapter
has been added which collects its results in a list. Thanks @Gottox!Beta: TreeStructureVisitor
and ConcreteSyntaxModel
.
705 755 Add the concrete syntax model, which will give you information about the exact syntax a certain nodes matches.
777 smaller improvements and fixes
This version is a beta because TreeStructureVisitor
is not in its definite state yet.
javaparser-metamodel
and javaparser-generator-utils
into javaparser-core
.ModifierVisitor
is now created by a code generator. Its behaviour has been made logical, and may give different results than before.ConstructorDeclaration
and MethodDeclaration
now share a parent: CallableDeclaration
This version is a beta because there are a lot of new features that may still change.
This version needs a minor version increase because of a backwards compatability issue:
* 719 getJavadoc
, getJavadocComment
and getComment
could return null. Our promise was to return Optional
, so that is what they do now.
New:
* 658 718 736 737 we have created a metamodel.
It gives information about the structure of the various AST nodes, as if you are introspecting them.
You can find it in javaparser-metamodel
, the main class is JavaParserMetaModel
* 353 365 visitors are no longer hand made, they are now generated from the metamodel. This should make them 100% reliable.
Affected visitors are: GenericVisitorAdapter
, EqualsVisitor
, VoidVisitorAdapter
, VoidVisitor
, GenericVisitor
, HashCodeVisitor
, CloneVisitor
.
If you want to generate your own visitors, you can use the VisitorGenerator
class from javaparser-core-generators
If you want to reuse the code generation utilities, look at module javaparser-generator-utils
- there is a very useful SourceRoot
class in there that takes away a lot of file management troubles.
* 538 735 TreeStructureVisitor
has been added, which should be considered beta.
* 220 733 717 749 745 750 743 748 666 732 746 734 733 smaller improvements and fixes
API breaking changes:
297: enable access to tokens.
PositionUtils.sortByBeginPosition
ConstructorDeclaration.getDeclarationAsString
setJavadoc
and getJavadoc
at various classesJavaparser.parse
MethodReferenceExpr
and TypeExpr
don't set themselves as parentsBug corrected: Casting signed primitive values double d = (double) -1; ^
Class c = (int.class);