Articles about extracting data from code, analyze it and programmatically transform it. In other words we talk about static analysis, automated refactoring, and code generation.

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 […]

Interview to Erik Dietrich on Static Analysis and a data driven approach to refactoring

Erik Dietrich is a well known Software Architect with a long experience in consulting. His blog (DaedTech) is a source of thoughtful insights on software development. In particular I was very interested by his usage of static analysis and code metrics in his consulting work. I am myself a relatively young consultant and I thought […]

Representation of the world inspired by Matrix

Generate diagrams from C# source code using Roslyn

Beyond the source code Last week we have seen how to use Roslyn to rewrite source code to your liking. That’s all well and good, but it’s not the only thing you can do when you have a compiler open and ready to do your bidding. Another possibility is to leverage the knowledge that the […]

Resolve method calls in Java code using the JavaSymbolSolver

Why I created the java-symbol-solver? A few years ago I started using JavaParser and then I started contributing. After a while I realized that many operations we want to do on Java code cannot be done just by using the Abstract Syntax Tree produced by a parser, we need also to resolve types, symbols and […]

Python reflection: how to list modules and inspect functions

Python reflection: how to list modules and inspect functions

Recently I have been playing with some ideas about applying static analysis to Python and building a Python editor in Jetbrains MPS. To do any of this I would need to first build a model of Python code. Recently we have seen how to parse Python code, however we still need to consider all the […]

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 […]

Walkmod: automatically refactor code to apply code conventions

Walkmod: Automatically Refactor Code to Apply Code Conventions

I am very interested in tools which support the software development process, making automatic the boring bits. One system which permits to go in that direction is Walkmod: a smart tool which can refactor Java projects and enforce code conventions. It is a quite powerful tool and it should ges more and more attention. TL; DR: Tools […]

How to build a symbol solver for Java, in Clojure

How to Build a Symbol Solver for Java, in Clojure

Last week we have seen how to build models of Java code from source and JAR files. Now we want to be able to solve symbols: in practice we want to link the symbol references in our source code to symbol declarations either in Java source files or jar files. This process is called symbol […]

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 […]

Effective Java: a tool to explore and measure your Java code written in Clojure

Effective Java: a Tool to Explore and Measure Your Java Code

When I was working at TripAdvisor we had this internal book club. We started by reading Effective Java, this very famous book from Joshua Bloch. It is interesting and all but I think this book was so successful that most of his advices are now part of the Java culture: most of Java developers know them and sort […]