JavaParser Blog

What our awesome contributors are talking about

Danny van Bruggen


Functional Tree Traversal

When you read the book, you will learn about traversing the AST by using visitors ...

Mar 29 2020

Danny van Bruggen


Testing JavaParser code

Several styles of testing have been used in JavaParser over the years, and although ...

Apr 6 2019

Danny van Bruggen


2.5.1 to 3.0.0 migration guide

Many methods have been added that help with building AST nodes. To help reuse ...

Apr 5 2019

Danny van Bruggen


Code Style/Architecture

Nothing in JavaParser returns null. Instead an Optional is returned. Nothing in JavaParser ...

Apr 4 2019

Danny van Bruggen


Pragmatic Versioning

At JavaParser we use a variation of Semantic Versioning that we might call “Pragmatic Versioning.” ...

May 10 2010

Danny van Bruggen


Analysing an entire project in one go

JavaParser works great to analyse java code and provides a way to process a source...

Apr 5 2018

Danny van Bruggen


Setting Java 8, 9, 10, etc

We needed to do some refactoring for Java 10 support, so you’ll find old way below under ...

Mar 3 2018

Danny van Bruggen


Semantic validations in JavaParser

As I was learning how JavaParser worked by fixing bugs and doing small changes ...

Mar 3 2018

Danny van Bruggen


Code generation and Maven in JavaParser

If you are not working on the JavaParser project itself, ignore this ...

Mar 3 2018

Danny van Bruggen


Inverting ifs in JavaParser

To answer a question from Kaleem on our Gitter channel, I made a little sample program that turns ...

Mar 3 2018

Danny van Bruggen


Parse error recovery

Since JavaParser 3.2.7, JavaParser is able to recover from parse errors. What does this mean? ...

Mar 3 2018

Danny van Bruggen


Less casting in JavaParser

A common pattern in code using JavaParser looks as follows: Federico Tomassetti, who maintains ...

Mar 3 2018

Danny van Bruggen


The quick and the full API of JavaParser

Lost in a dark corner of the JavaParser site is the idea behind the two API’s of JavaParser ...

Mar 3 2018

Danny van Bruggen


Making strings in JavaParser

There are various options for printing source code in JavaParser, and not all of them ...

Mar 3 2018

Danny van Bruggen


The logging framework in one file

Ah, logging, the most important topic in the Java programming world if you look at the ...

Mar 3 2018

Danny van Bruggen


Inspecting an AST

Two of the more common questions on JavaParser are: If I have this piece of code, how do I access that ...

Mar 3 2018

Federico Tomassetti


Implementing Lexical Preservation for JavaParser

Many users of JavaParser are asking to implement lexical preservation ...

Dec 13 2016

Federico Tomassetti


Observers for AST nodes in JavaParser

We are getting closer to the first Release Candidate for JavaParser 3.0. One of the last features ...

Nov 22 2016

Federico Tomassetti


Getting started with JavaParser: analyzing Java Code programmatically

One of the things I like the ...

Feb 10 2016

Federico Tomassetti


Java comments parsing

Recently I have done some work on JavaParser, focusing on parsing comments and attributing them ...

Jul 19 2014