Implement CDC 1.1 LinkedHashMap - #197
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #197 +/- ##
==========================================
+ Coverage 87.57% 87.74% +0.17%
==========================================
Files 292 298 +6 Lines 38347 39025 +678 ==========================================
+ Hits 33582 34244 +662 - Misses 4765 4781 +16 ☔ 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 adds a CDC 1.1-compatible java.util.LinkedHashMap implementation to java_runtime, including ordered views and fail-fast iterators, and refactors HashMap to provide internal hooks (load factor, mod tracking, entry lifecycle callbacks) that LinkedHashMap builds on.
Changes:
- Introduce
java/util/LinkedHashMapplus ordered entry nodes and iterator types (key/value/entry) backed by a linked-list header sentinel. - Extend
java/util/HashMapwith load-factor support,modCount, and virtual hooks (initializeMap,storeNewEntry,insertNewEntry,keyIterator/valueIterator/entryIterator,onAccess/onRemoval) to support subclass behaviors. - Add comprehensive runtime-level tests validating constructor argument validation, insertion/access order semantics, view/iterator behavior (including fail-fast), rehashing, and
removeEldestEntry.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| java_runtime/tests/classes/java/util/test_linked_hash_map.rs | Adds behavior and API-shape tests for CDC 1.1 LinkedHashMap, including order semantics, null mappings, rehashing, iterators, and removeEldestEntry. |
| java_runtime/tests/classes/java/util/mod.rs | Registers the new LinkedHashMap test module. |
| java_runtime/src/loader.rs | Registers LinkedHashMap and its nested runtime classes in the class proto loader. |
| java_runtime/src/classes/java/util/linked_hash_map.rs | Implements java/util/LinkedHashMap constructors, order-preserving storage, access-order get, and iterator factories. |
| java_runtime/src/classes/java/util/linked_hash_map_entry.rs | Implements ordered entry nodes and access/removal hooks to maintain the linked list and fail-fast behavior. |
| java_runtime/src/classes/java/util/linked_hash_map_linked_hash_iterator.rs | Implements the shared ordered, fail-fast iterator base for LinkedHashMap views. |
| java_runtime/src/classes/java/util/linked_hash_map_key_iterator.rs | Key iterator specialization over ordered entries. |
| java_runtime/src/classes/java/util/linked_hash_map_value_iterator.rs | Value iterator specialization over ordered entries. |
| java_runtime/src/classes/java/util/linked_hash_map_entry_iterator.rs | Entry iterator specialization returning Map.Entry objects. |
| java_runtime/src/classes/java/util/hash_map.rs | Refactors HashMap to add load factor, modCount, subclass hooks, and iterator indirection for ordered/fail-fast subclasses. |
| java_runtime/src/classes/java/util/hash_map_values.rs | Updates Values view iteration/removal to use entryIterator/valueIterator hooks. |
| java_runtime/src/classes/java/util/hash_map_key_set.rs | Updates KeySet iterator to use the keyIterator hook. |
| java_runtime/src/classes/java/util/hash_map_entry_set.rs | Updates EntrySet iterator to use the entryIterator hook. |
| java_runtime/src/classes/java/util/hash_map_entry.rs | Adds entry lifecycle hooks (onAccess, onRemoval) and ensures public accessors align with public API usage. |
| java_runtime/src/classes/java/util.rs | Wires new util module files into the build and re-exports the new types. |
| AGENTS.md | Documents compatibility/provenance guidance for Java compatibility work. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:a377e64fe4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
java.util.LinkedHashMappublic APIremoveEldestEntrypoliciesHashMapwith load-factor handling, modification tracking, and internal subclass hooksValidation
cargo fmt --all -- --checkgit diff --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p java_runtime(468 passed)cargo test --workspace(531 passed, 1 existing ignored)