Posts

Extracting JavaDoc documentation from source files using JavaParser

A lot of people are using JavaParser for the most different goals. One of these is extracting documentation. In this short post we will see how you can print all the JavaDoc comments associated to classes or interfaces. Code is available on GitHub: https://github.com/ftomassetti/javadoc-extractor Getting all the Javadoc comments for classes We are reusing DirExplorer, a supporting […]

Implementing Lexical Preservation for JavaParser

Many users of JavaParser are asking to implement lexical preservation, i.e., the ability of parsing a Java source file, modifying the AST and get back the modified Java source code keeping the original layout. Currently this is not supported by JavaParser: you can parse all Java 8 code with JavaParser, get an AST but then the […]

Observers for AST nodes in JavaParser

We are getting closer to the first Release Candidate for JavaParser 3.0. One of the last features we added was support for observing changes to all nodes of the Abstract Syntax Tree. While I wrote the code for this feature I received precious feedback from Danny van Bruggen (a.k.a. Matozoid) and Cruz Maximilien. So I […]

Getting Started with JavaParser

Getting started with JavaParser: analyzing Java Code programmatically

One of the things I like the most is to parse code and to perform automatic operations on it. For this reason I started contributing to JavaParser and created a couple of related projects: java-symbol-solver and effectivejava. As a contributor of JavaParser I read over and over some very similar questions about extracting information from Java source code. For this […]

Building models of Java code from source and JAR files

Building Models of Java Code from Source and JAR Files

Recently I spent some time working on effectivejava, which is on its way to reach 300 stars on GitHub (feel free to help reaching the target :D). Effectivejava is a tool to run queries on your Java code. It is based on another project I contribute to, javaparser. Javaparser takes as input Java source code […]

Java comments parsing

Parsing Java Comments

Recently I have done some work on JavaParser, focusing on parsing comments and attributing them to the element being commented. I like working on manipulating source code. I like this problem also because it does not have obvious solutions, but it can be solved only relaying on heuristics and conventions. Some notes on comments parsing […]