[rustjava-runtime-time-todo-impl] fix: implement time APIs in RuntimeImpl + regression fixture - #2
Merged
Merged
Conversation
System.currentTimeMillis(), Thread.sleep(), Thread.yield(), new Date() and everything else routed through Runtime::now/sleep/yield crashed the deployed binary with a Rust panic because the only production Runtime implementation left them as todo!(). Tests stayed green because the integration corpus never exercised these APIs and TestRuntime had its own (partial) implementations. - RuntimeImpl::now -> SystemTime since UNIX_EPOCH in ms - RuntimeImpl::sleep -> tokio::time::sleep - RuntimeImpl::yield -> tokio::task::yield_now (also fills the todo!() in TestRuntime so test and binary behavior match) - root Cargo.toml: add tokio "time" feature (both target sections) - test_data/TimeApi: fixture calling currentTimeMillis/yield/sleep/Date with deterministic assertions (positivity/monotonicity/min-elapsed), locking the regression through the RuntimeImpl integration path Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolve STATE.md/REPORT.md add/add conflicts with the superset per the strategy recorded in STATE.md. No code changes vs approved pin 3afb6cc. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Jun025
pushed a commit
that referenced
this pull request
Jul 22, 2026
STATE.md superset resolution; REPORT.md auto-merged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The only production
Runtimeimplementation (RuntimeImpl, the sole path used by therust_javabinary viasrc/lib.rs) hadnow(),sleep(), andr#yield()left astodo!(). Any Java program touchingSystem.currentTimeMillis(),Thread.sleep(),Thread.yield(),new Date(),Timer, orObject.wait(long)died with a Rust panic instead of running. CI stayed green because thetest_datacorpus used none of these APIs andTestRuntimehad its own implementations.Changes
src/runtime.rs:now()→ epoch ms viaSystemTime;sleep()→tokio::time::sleep;r#yield()→tokio::task::yield_nowtest_utils/src/lib.rs: fill the matchingr#yield()todo!()so test/binary behavior stays identicalCargo.toml: add tokiotimefeature to both target sections (only change; no other features/versions touched)test_data/TimeApi.{class,txt}: new fixture (compiled--release 21) exercising currentTimeMillis / yield / sleep / Date through theRuntimeImplintegration path, with deterministic assertions only (positivity, monotonicity, ≥50ms elapsed after a 100ms sleep — no absolute-time or tight-timing checks)Fixture source (repo convention keeps only .class + .txt):
Evidence
Before fix (fixture added first — reproduces through
RuntimeImpl):After fix:
cargo test --all: all green, 0 failures (test_class now includes TimeApi: 1 passed)cd test_data && rust_java TimeApi→ all 5 assertion lines pass, exit 0cargo build,cargo fmt --check,cargo clippy --all-targetscleanNon-goals (per ticket)
jvm_rust/src/interpreter.rs:629remainingtodo!()🤖 Generated with Claude Code