Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
title: Java description: Port a package of public static methods to Rust through typed JNI and a generated binary wire, in wrapper classes with the original methods.
Java
| Unit | a package of public static methods |
| Bridge | typed JNI and a generated binary wire, in wrapper classes with the original methods |
| Recorded and replayed by | a generated reflection driver |
| Needs | JDK 17+ (javac and java) |
| Status | Verified on JDK 21 behind a facade: 4,492/4,492 (226 throw), gate passes |
Batches are new FnBatch(items); close them when done. profile uses JFR.
What a port has to get right
Integer.parseIntaccepts any Unicode decimal digit (١٢,2) throughCharacter.digit.Double.toString(JDK 19+) prints the shortest decimal, but never fewer than two digits:4.9E-324, where Rust's shortest form is5e-324.\sis ASCII-only; Rust'ssplit_whitespacealso splits at U+00A0.- Floats must survive the round trip:
serde_json's default float parser is not always correctly rounded, so rust-anything and every crate it generates use itsfloat_roundtripfeature.
Speed
After the JIT, leaf functions take a few nanoseconds, and a JNI call with strings costs more than that. On the JDK facade, bench measured the port at 0.18x per call: port bigger units. A batch on 4 cores is not a win here: under JMH the Java original (9.8 ms) beat the Rust batch (24.7 ms) on 4 workers, so an earlier 3x claim was withdrawn. Measure with bench before shipping a Java port.
Details: Six languages.