What it is
The core of CodeLaser’s static analysis.
maddi is a static analyzer that works across the whole codebase, for Java and Kotlin. The CodeLaser engine builds its restructuring operations on top of it. For every field, parameter and return value it works out which objects flow where and which of them share state. From that it derives what each method modifies and what is only read: the difference that decides what can safely move when a codebase is restructured.
Because it is open source, the core of the engine’s analysis can be read, run and checked by anyone. The details, from installation to the full list of options, are on GitHub and in the user manual.
Immutability
maddi computes levels of immutability.
Knowing what can change, and where, is what makes it safe to change code. An object nothing can modify can be shared, moved or reused without one part of the codebase altering state another part relies on.
Real code is rarely deeply immutable. A yes/no answer would throw away everything useful, so maddi gives each type a level. One line in this class moves it from one level to the next.
The caller keeps the map
@FinalFields @Container
public final class Config {
private final Map<String, String> settings;
public Config(Map<String, String> settings) {
this.settings = settings;
}
public String get(String key) {
return settings.get(key);
}
}
The field is final and nothing in the class modifies it. The caller still holds the map it passed in, so anyone outside can change this object’s state after it is built.
The class copies the map
@Immutable(hc=true) @Container
public final class Config {
private final Map<String, String> settings;
public Config(Map<String, String> settings) {
this.settings = Map.copyOf(settings);
}
public String get(String key) {
return settings.get(key);
}
}
After the copy, the only link left runs to the map’s elements.
hc=true (hidden content) records that those elements are of a type
Config cannot see into.
@Mutable, @FinalFields, @Immutable(hc=true) and @Immutable. The reason a type stopped at its level tells you what to change to take it further.
You write none of these annotations. maddi derives them for every type, method and field, and where you do write one yourself, it checks it against what it computed.
@Mark, @Only and @Immutable(after=…) describe the builder and freeze patterns: types that are mutable while being constructed, and immutable ever after.
@Fresh, @Borrowed and @Owned say who may hold an object: a result the call created, a parameter nothing keeps after the call, a field reachable only through its holder. New in 0.9.7. The IDE plugins always compute them; on the command line and in the build plugins they are opt-in.
In your IDE
The verdicts appear in the editor.
The plugins for IntelliJ IDEA, Eclipse and VS Code show maddi’s annotations in the code, where you would write them yourself: above a declaration, and before a parameter’s type. Hover over one to see why it holds: the chain of statements from the element down to the line that decides it.
A contract you wrote that the code breaks is marked where it breaks. Each plugin bundles the analyzer and runs it on your own machine, so your code does not leave it.
@FinalFields and
@Dependent, and why it is not a @Container, each reason with the line
it comes from.IntelliJ analyses Java and Kotlin; Eclipse and VS Code analyse Java. The VS Code extension is a preview. The IDE user guide covers setup, reading the results and the settings.
For coding agents
A coding agent can ask maddi about the code.
maddi-mcp is an MCP server. A coding
agent such as Claude Code uses it to configure a project, run the analysis and ask about
the results: an overview of a package or type, the verdicts on an element and why they
hold, and what changed between two runs after an edit. It runs the same analysis as the
IDE plugins, so the agent sees what the IDE shows.
Every answer says how far it can be trusted: only final values are certified. maddi-mcp answers questions about the code. Making the changes across a whole codebase is the job of the CodeLaser engine.
Claude Code, on macOS or Linux
brew install codelaser/tap/maddi-mcp claude mcp add maddi -- $(brew --prefix)/bin/maddi-mcp
Kotlin
Kotlin is analysed the same way as Java.
maddi reads Kotlin through K2, the Kotlin compiler’s own front end. From there on, Kotlin and Java share one syntax tree and one analysis, with no Kotlin-specific paths. Paired Kotlin and Java test cases check that both get the same verdicts.
A project that mixes the two
languages is analysed as a whole, so references from Java into Kotlin and back are
part of the same analysis. In 0.9.7 the Kotlin front end converts nearly
every construct: on the Exposed library, the declarations it had to leave as
placeholders went from 243 to 3. Fernflower, analysed once from Kotlin and once from Java,
now gets the same verdict for every type. The Gradle plugin analyses Kotlin sources. The
maddi-kotlin distribution takes the same command line as
maddi.
Where it stands
How mature each part is in 0.9.7.
0.9.7 was released on 25 November 2026.
| Part | State |
|---|---|
| Concepts, and the book | Stable |
| Java front end | Robust, on JDK 27. Run against many open-source projects and one closed-source codebase of about 3M lines |
| Kotlin front end | Converts nearly every construct. Mixed Java and Kotlin projects are analysed as a whole |
| Modification & immutability analysis | Settles on the same verified answer every time, on all our test projects: Timefold, LangChain4j, Fernflower, Guava, ActiveMQ, Jenkins, Camel |
| Ownership | New in 0.9.7. Opt-in on the command line and in the build plugins |
| Nullability | Measured against an oracle on Guava: disagreements went from 1,977 to 1,786 in 0.9.7 |
| IDE plugins | IntelliJ IDEA and Eclipse published; VS Code in preview. Eclipse and VS Code analyse Java only |
| MCP server for coding agents | Published |
| Incremental re-analysis | Experimental, in the IDE plugins and the MCP server. Off by default |
| Translation to Kotlin, C# and Rust | Kotlin: all 610 of Guava’s files compile. C# and Rust are experimental |
| Gradle and Maven plugins, command line | Published |
The analyzer is stable on everything we run it on. Your codebase will contain Java that ours do not. If maddi mis-reads your code, crashes, or works something out you can argue is wrong, please open an issue. What changed in this release is in the release notes.
Install
Install it in your IDE, your build or your agent.
The analyzer needs JDK 25 or later. The IntelliJ and Eclipse plugins pick one from the IDE’s own JDKs. The Kotlin distribution, and the Gradle plugin on a project with Kotlin sources, need JDK 26 or later.
| For | Where |
|---|---|
| IntelliJ IDEA | maddi on JetBrains Marketplace |
| Eclipse | maddi on the Eclipse Marketplace, or the update site https://codelaser.github.io/maddi-dist/eclipse/ |
| VS Code (preview) | maddi on the VS Code Marketplace and Open VSX |
| Coding agents (MCP) | brew install codelaser/tap/maddi-mcp, io.github.codelaser/maddi-mcp on the MCP Registry, or the zip on GitHub Releases |
| Gradle | io.codelaser.maddi.analyzer on the Gradle Plugin Portal |
| Maven | io.codelaser:maddi-mvnplugin on Maven Central |
| Command line | brew install codelaser/tap/maddi (or maddi-kotlin), or the self-contained zips on GitHub Releases |
| Annotations | io.codelaser:maddi-annotation on Maven Central |
Gradle plugin
plugins {
java
id("io.codelaser.maddi.analyzer") version "0.9.7"
}Command line
./gradlew :your-module:compileJava --debug 2>&1 \
| grep 'Compiler arguments:' > build.log
maddi --compile-log build.log \
--analysis-steps modification --analysis-results-dir outThe user manual covers configuration and how to point the command line at your build.
Licence
Open source under Apache-2.0.
From 0.9.6 onward all of maddi is licensed under Apache-2.0: the analyzer,
the build and IDE plugins, the MCP server and the annotations. Companies whose policies
rule out GPL-family licences can now build on it. Apache-2.0 also includes an explicit
patent grant. Releases up to 0.9.5 keep the licence they were published under.
Contributions are made under a Contributor License Agreement; CONTRIBUTING.md explains how. maddi started in 2019 as e2immu and is developed by Bart Naudts at CodeLaser.