Skip to content

Fix Cloneable and Serializable class metadata - #200

Merged
dlunch merged 2 commits into
mainfrom
agent/cloneable-serializable-hierarchy
Aug 12, 2026
Merged

Fix Cloneable and Serializable class metadata#200
dlunch merged 2 commits into
mainfrom
agent/cloneable-serializable-hierarchy

Conversation

@dlunch

@dlunchdlunch commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • add missing Cloneable and Serializable metadata to 15 Java runtime classes
  • register java/io/Serializable before java/lang/Class during bootstrap to avoid recursive class loading

Root cause

Several runtime class prototypes omitted marker interfaces declared by their public Java API. Adding Serializable to java.lang.Class also exposed an initialization cycle: class registration attempted to resolve Serializable before Class itself was available. Pre-registering the dependency as a bootstrap definition keeps the existing loading model while breaking that cycle.

Validation

  • cargo test -p java_runtime (483 passed)
  • cargo fmt --all -- --check
  • git diff --check

CopilotAI lite review requested due to automatic review settings August 11, 2026 23:19
@codecov

codecovBot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.61%. Comparing base (a1e6fdf) to head (27822c8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #200 +/- ##
=======================================
Coverage 86.61% 86.61% =======================================
Files 308 308 Lines 41532 41539 +7 =======================================
+ Hits 35972 35979 +7 
Misses 5560 5560 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects Java marker-interface metadata in the Rust-based Java runtime, and adjusts JVM bootstrap ordering to avoid a class-loading cycle introduced by making java/lang/Class implement java/io/Serializable.

Changes:

  • Add missing Cloneable / Serializable interfaces to a set of Java runtime class prototypes.
  • Register/load java/io/Serializable before java/lang/Class during JVM bootstrap.
  • Add a new test validating direct vs inherited marker interfaces via public java.lang.Class APIs.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
jvm/src/jvm.rsAdjust bootstrap class load order to register java/io/Serializable before java/lang/Class.
java_runtime/tests/classes/java/mod.rsInclude the new marker-interface test module in the test suite.
java_runtime/tests/classes/java/test_marker_interfaces.rsNew test validating marker interfaces for direct/inherited/negative cases using reflection APIs.
java_runtime/src/classes/java/lang/class.rsDeclare java/lang/Class as implementing java/io/Serializable.
java_runtime/src/classes/java/lang/throwable.rsDeclare java/lang/Throwable as implementing java/io/Serializable.
java_runtime/src/classes/java/io/file.rsDeclare java/io/File as implementing java/io/Serializable.
java_runtime/src/classes/java/net/url.rsDeclare java/net/URL as implementing java/io/Serializable.
java_runtime/src/classes/java/util/calendar.rsDeclare java/util/Calendar as implementing java/io/Serializable and java/lang/Cloneable.
java_runtime/src/classes/java/util/array_list.rsDeclare java/util/ArrayList as implementing java/lang/Cloneable and java/io/Serializable.
java_runtime/src/classes/java/util/hash_map.rsDeclare java/util/HashMap as implementing java/lang/Cloneable and java/io/Serializable.
java_runtime/src/classes/java/util/hash_set.rsDeclare java/util/HashSet as implementing java/lang/Cloneable and java/io/Serializable.
java_runtime/src/classes/java/util/hashtable.rsDeclare java/util/Hashtable as implementing java/lang/Cloneable and java/io/Serializable (in addition to java/util/Map).
java_runtime/src/classes/java/util/vector.rsDeclare java/util/Vector as implementing java/lang/Cloneable and java/io/Serializable (in addition to java/util/List).
java_runtime/src/classes/java/util/jar/attributes.rsDeclare java/util/jar/Attributes as implementing java/lang/Cloneable.
java_runtime/src/classes/java/util/jar/manifest.rsDeclare java/util/jar/Manifest as implementing java/lang/Cloneable.
java_runtime/src/classes/java/util/logging/level.rsDeclare java/util/logging/Level as implementing java/io/Serializable.
java_runtime/src/classes/java/util/logging/log_record.rsDeclare java/util/logging/LogRecord as implementing java/io/Serializable.
java_runtime/src/classes/java/util/zip/zip_entry.rsDeclare java/util/zip/ZipEntry as implementing a marker interface (updated in this PR).
Suppressed comments (1)

java_runtime/tests/classes/java/test_marker_interfaces.rs:61

  • JarEntry inherits marker interfaces from ZipEntry. If ZipEntry is updated to implement Serializable, the inherited marker expectations should include java/io/Serializable as well.
 ("java/util/Stack", &["java/lang/Cloneable", "java/io/Serializable"]),
("java/util/LinkedHashMap", &["java/lang/Cloneable", "java/io/Serializable"]),
("java/util/jar/JarEntry", &["java/lang/Cloneable"]),
];

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment threadjava_runtime/src/classes/java/util/zip/zip_entry.rs
Comment threadjava_runtime/tests/classes/java/test_marker_interfaces.rs Outdated
@dlunch
dlunch merged commit b9da252 into mainAug 12, 2026
15 checks passed
@dlunch
dlunch deleted the agent/cloneable-serializable-hierarchy branch August 12, 2026 10:14
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@dlunch