Fix Cloneable and Serializable class metadata - #200
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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/Serializableinterfaces to a set of Java runtime class prototypes. - Register/load
java/io/Serializablebeforejava/lang/Classduring JVM bootstrap. - Add a new test validating direct vs inherited marker interfaces via public
java.lang.ClassAPIs.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| jvm/src/jvm.rs | Adjust bootstrap class load order to register java/io/Serializable before java/lang/Class. |
| java_runtime/tests/classes/java/mod.rs | Include the new marker-interface test module in the test suite. |
| java_runtime/tests/classes/java/test_marker_interfaces.rs | New test validating marker interfaces for direct/inherited/negative cases using reflection APIs. |
| java_runtime/src/classes/java/lang/class.rs | Declare java/lang/Class as implementing java/io/Serializable. |
| java_runtime/src/classes/java/lang/throwable.rs | Declare java/lang/Throwable as implementing java/io/Serializable. |
| java_runtime/src/classes/java/io/file.rs | Declare java/io/File as implementing java/io/Serializable. |
| java_runtime/src/classes/java/net/url.rs | Declare java/net/URL as implementing java/io/Serializable. |
| java_runtime/src/classes/java/util/calendar.rs | Declare java/util/Calendar as implementing java/io/Serializable and java/lang/Cloneable. |
| java_runtime/src/classes/java/util/array_list.rs | Declare java/util/ArrayList as implementing java/lang/Cloneable and java/io/Serializable. |
| java_runtime/src/classes/java/util/hash_map.rs | Declare java/util/HashMap as implementing java/lang/Cloneable and java/io/Serializable. |
| java_runtime/src/classes/java/util/hash_set.rs | Declare java/util/HashSet as implementing java/lang/Cloneable and java/io/Serializable. |
| java_runtime/src/classes/java/util/hashtable.rs | Declare 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.rs | Declare 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.rs | Declare java/util/jar/Attributes as implementing java/lang/Cloneable. |
| java_runtime/src/classes/java/util/jar/manifest.rs | Declare java/util/jar/Manifest as implementing java/lang/Cloneable. |
| java_runtime/src/classes/java/util/logging/level.rs | Declare java/util/logging/Level as implementing java/io/Serializable. |
| java_runtime/src/classes/java/util/logging/log_record.rs | Declare java/util/logging/LogRecord as implementing java/io/Serializable. |
| java_runtime/src/classes/java/util/zip/zip_entry.rs | Declare 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.
Summary
CloneableandSerializablemetadata to 15 Java runtime classesjava/io/Serializablebeforejava/lang/Classduring bootstrap to avoid recursive class loadingRoot cause
Several runtime class prototypes omitted marker interfaces declared by their public Java API. Adding
Serializabletojava.lang.Classalso exposed an initialization cycle: class registration attempted to resolveSerializablebeforeClassitself 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 -- --checkgit diff --check