Java

Fix Java bugs with Codna

Codna maps your Java project for zero tokens, fixes from evidence, and runs your Maven or Gradle tests until they pass.

The problem

A failing JUnit test names a class. The cause is three layers down.

Codna builds a dependency and blast-radius graph of the repository from its import patterns. No model call, zero tokens. Imports are the edges, so the agent follows the call chain from the test through services and repositories to the code that changed.

How Codna fixes it

How Codna fixes it

1

Map the Java repository

Codna builds a dependency and blast-radius graph of the repository from its import patterns. No model call, zero tokens.

2

Fix from evidence

The agent receives an evidence bundle scoped to the issue: the suspect files, the call paths, the failing test. Codna prints the raw-to-bundle token size on every run. Every fix reports root cause, confidence, blast radius and regression risk, and passes a risk gate before it is applied or a pull request opens.

3

Verify with Maven or Gradle

Run codna fix --tests --apply and Codna runs your tests in a sandbox and re-fixes until they pass, up to the iteration limit you set. Set fix.test_command in codna.yaml, or pass --test-cmd, when your runner is not pytest. With --open-pr, or through the GitHub App, the pull request states the issue, the root cause, the symbols touched and a confidence score, and asks for review before merging. Codna never merges.

pip install codna
codna fix . --issue "OrderServiceTest.testApplyDiscount fails after refactor" --tests --apply --test-cmd "./gradlew test"

What you get

Built for Java

Maven and Gradle

Set fix.test_command to your build tool's test task. JUnit XML reports are read from $CODNA_JUNIT.

Java-aware recall

On-device recall parses .java files with tree-sitter.

Blast radius across packages

Codna reports what a change reaches before you apply it.

The proof

Fewer tokens. Faster. Verified.

Codna16K
Cursor81K
Average tokens per fix on 87 matched bug-fix cases: Codna and Cursor.

Frequently asked

Install with pip, then codna fix . --issue "..." or --tests --apply with your Gradle or Maven test command. Every fix reports root cause, confidence, blast radius and regression risk, and passes a risk gate before it is applied or a pull request opens.

Yes, through fix.test_command or --test-cmd. Point it at a command that writes JUnit XML to $CODNA_JUNIT.

JUnit and TestNG through your build tool, or any runner that writes JUnit XML.

Imports are the edges of the map. Runtime injection is a lower bound; your tests verify the behaviour.

On 87 matched bug-fix cases against Cursor, Codna averaged 16,159 total tokens and about $0.02 of model spend per verified fix, 5× fewer tokens and 1.7× faster. With your own key you pay your provider directly.

Understanding runs on your machine and spends no tokens. Only the evidence bundle or the diff reaches your model provider, with your key from the OS keychain. Set privacy.egress to fail-closed in codna.yaml and Codna runs your tests only under kernel-level network denial. Secret redaction is always on.

Understand. Fix. Evolve.