Converting Java to Rust

This is an in-progress fork of the project talked about in the thread below, the goal being to eventually have full support for Java 25.

I'm sharing this in case anyone is interested, mostly to help my burned-out AuDHD dopamine receptors motivate me to continue this project.

While it doesn't yet produce Rust code that compiles without changes, it's really not that far off and that goal seems achievable.

I've (re-)implemented it as a multi-pass process:

  • Parse and pre-process all the Java code, extracting declarations for later passes
  • Analyze the Java code, propagate thrown errors (for eventual conversion to Result-based handling), propagate mut methods based on implementations and calls, etc.
  • Generate a Rust workspace by walking that module graph, implementations emit Rust code as the Java code is (re-)visited

My test case for this project is the project itself (and its dependencies), I've included the generated Rust workspace in the repo so you can see the progress.

Ah and the current codebase is a bit of a mess.

All my Java code is web applications. Is there some Rust replacement for for war files?

I don’t know what war files are, so not currently no.

Interesting, how (if at all) will you handle differences in the standard libraries between the two languages?

I was planning on making a java crate that would implement the JVM functions and a system for replacing specific function calls with Rust expressions