---
title: "How we migrated our static analyzer from Java to Rust"
description: "Datadog rewrote the Codiga static analyzer from Java to Rust after switching its parser from ANTLR to Tree-sitter, whose Java bindings lacked features like pattern matching."
url: "https://swe.quest/articles/how-we-migrated-our-static-analyzer-from-java-to-rust-8d2e3080358d7827"
canonical: "https://www.datadoghq.com/blog/engineering/how-we-migrated-our-static-analyzer-from-java-to-rust/"
source: "Datadog Engineering"
published: "2024-05-23"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["rust","static-analysis","refactoring","performance","jvm"]
---

# How we migrated our static analyzer from Java to Rust

A post on [Datadog Engineering](https://swe.quest/sources/datadog.md), published 2024-05-23, 8 min read, Case study. Original: [https://www.datadoghq.com/blog/engineering/how-we-migrated-our-static-analyzer-from-java-to-rust/](https://www.datadoghq.com/blog/engineering/how-we-migrated-our-static-analyzer-from-java-to-rust/)

## Summary

Datadog rewrote the Codiga static analyzer from Java to Rust after switching its parser from ANTLR to Tree-sitter, whose Java bindings lacked features like pattern matching. The rewrite ran analysis about 3x faster with roughly 10x less memory, which matters on small CI runners. Shipping a single binary also removed the JVM dependency, so the same analyzer now runs inside the IDE. The team replaced GraalVM with deno-core as a sandboxed JavaScript rule runtime and mapped Java libraries to serde\_yaml, reqwest and rayon. Learning Rust and migrating took about a month, helped by parity tests, clippy and rustfmt.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Static analysis](https://swe.quest/tags/static-analysis.md) (Engineering practices)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Java & JVM](https://swe.quest/tags/jvm.md) (Languages)

## Prerequisites

- abstract syntax trees
- static analysis basics ([easy posts on Static analysis](https://swe.quest/tags/static-analysis.md?difficulty=easy))

## Keywords

Tree-sitter, ANTLR, GraalVM, deno, rayon, Datadog Code Analysis, Codiga

## Related posts

- [Our Experience Porting the YJIT Ruby Compiler to Rust](https://swe.quest/articles/our-experience-porting-the-yjit-ruby-compiler-to-rust-221d770c36dd7d35.md): Shopify Engineering · 2022-05-11 · Medium · 16 min read · Rust, Compilers, Ruby, Refactoring & migrations, C & C++
  Shopify's YJIT team ported the CRuby JIT compiler from about 11,000 lines of C99 to Rust because C's lack of modules, generics, containers and safe macros made a growing compiler hard to manage.
- [We Have to Start Over: From Atom to Zed](https://swe.quest/articles/we-have-to-start-over-from-atom-to-zed-8db3be76f03d8a79.md): Zed · 2024-02-12 · Easy · 25 min read · Rust, Developer tools, Performance engineering, Data structures
  Zed's co-founders explain why they abandoned Atom's Electron/JavaScript stack and rebuilt a code editor in Rust: JavaScript's pointer-chasing arrays, uncontrollable GC pauses, and the costly JS/C++ boundary for multithreading made performance work feel like fighting the platform.
- [Everything Is Broken: Shipping rust-minidump at Mozilla – Part 1](https://swe.quest/articles/everything-is-broken-shipping-rust-minidump-at-mozilla-part-1-75139938732d2040.md): Mozilla Hacks · 2022-06-14 · Medium · 19 min read · Rust, Testing, Debugging, Refactoring & migrations
  rust-minidump, a pure-Rust replacement for the minidump-processing half of Google Breakpad, has been Firefox's crash-processing backend for six months, running in about half the time of Breakpad and appearing more reliable.
- [Ruby 3.2’s YJIT is Production-Ready](https://swe.quest/articles/ruby-3-2-s-yjit-is-production-ready-05f17a68a56ea05c.md): Shopify Engineering · 2023-01-17 · Easy · 10 min read · Ruby, Compilers, Runtimes & VMs, Performance engineering, Rust
  YJIT, Shopify's JIT compiler for CRuby, became production-ready in Ruby 3.2 after a port from C99 to Rust and a cut in memory overhead to about a third of Ruby 3.1 levels.
- [Translating Java to Kotlin at Scale](https://swe.quest/articles/translating-java-to-kotlin-at-scale-3648a1737157b36f.md): Meta Engineering · 2024-12-18 · Medium · 13 min read · Java & JVM, Refactoring & migrations, Mobile, Static analysis, Developer tools
  Meta is translating roughly ten million lines of Android Java to Kotlin using the Kotlinator, an automated pipeline built around a headless version of JetBrains' J2K.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
