cure-java-simplify
The Java rule pack of cure: 30
Java-specific semantic-preserving simplification rules (64 with the engine's
34 built-ins) over
cure-java-ast, driven to a fixed
point by cure-engine.
The point is not compression — it is making decompiled code read like
hand-written code: fold constants and opaque predicates, inline copies, kill
dead stores and compiler register noise, recover StringBuilder statement
chains, dissolve control-flow-flattening state machines, evaluate
literal-only JDK calls, and restore idiomatic shapes (try-with-resources,
string switch).
use Config;
use parse;
use print_unit;
use simplify_unit;
let src = "class B { void n() { int x = 1 + 2; boolean c = (x > 2) && true;
if (c) { System.out.println(\"y\" + 1); } return; } }";
let mut out = parse;
let report = simplify_unit;
println!;
println!;
// class B {
// void n() {
// System.out.println("y1");
// }
// }
Correctness methodology
Every rule is gated by effect analysis (evaluation order, short-circuiting,
and side-effect sequences are preserved) and validated in three layers:
property testing against an interpreter, differential testing against real
javac/java runs (byte-identical stdout/exit codes/exception signatures),
and whole-corpus idempotency (second pass makes zero edits). See the
verification section
of the repository README.
Notable rules: cff_recover (control-flow flattening recovery),
literal_eval (partial evaluation of literal-only JDK calls),
string_builder_statements (statement-level builder-chain recovery),
store_kill (dominating-path dead-store kill), xor_noise,
twr_recover / string_switch_recover (decompiler shape restoration).
Full catalog in the repository README.
License: MIT. Zero runtime dependencies.