← ClaudeAtlas

port-from-javalisted

Port Java into Rust — class hierarchies onto enums and composition, exceptions onto Result, collections and streams onto Rust equivalents, and the traps (UTF-16 strings, silent integer wraparound, null, equals/hashCode contracts). Use when porting, rewriting, or migrating Java, a JVM service, a Spring or Jakarta application, or a Java library into Rust, when replacing a JVM component with a Rust one behind the same interface, or when the user asks how a Java construct translates to Rust.
rewrite-rs/skills · ★ 2 · AI & Automation · score 73
Install: claude install-skill rewrite-rs/skills
# Port from Java ## A construct mapping and a boundary, nothing else This skill maps Java to Rust and owns the Java boundary — a process seam under end state A, and JNI under B and C. The parity contract, the five phases, and the anti-patterns are `/port-to-rust`, which runs first and stays running through the port. It covers Java, not Kotlin and not Scala — the JVM is shared, the idioms are not. ## The end state, and why Java usually lands on A or B-as-a-service | End state | In Java terms | JNI | |---|---|---| | A. Replacement | A standalone Rust binary or crate replaces a JVM service; the seam is the HTTP or gRPC boundary the system already has | Never appears | | B. Rust core, JVM artifact is the product | The importable artifact keeps its name and its signatures; the engine underneath becomes Rust | Permanent public surface — signatures, exception classes, native libraries per platform, semver | | C. Scaffold | The port ends standalone, but the JVM calls the Rust code while the migration is under way | Temporary, and deleted at cut-over | The end-state decision is `/port-to-rust`. JNI is the most expensive boundary in this set to write, to test, and to keep safe, and a mistake in it is a JVM crash rather than an exception — the reason Java usually lands on A. Prefer a process boundary over JNI unless per-call latency genuinely forbids it; the mechanics for both are in `BOUNDARY.md`. ## The traps that break parity silently The body carries these five because each o