Skip to content

Implement CDC 1.1 LinkedHashMap - #197

Merged
dlunch merged 3 commits into
mainfrom
agent/linked-hash-map
Aug 9, 2026
Merged

Implement CDC 1.1 LinkedHashMap#197
dlunch merged 3 commits into
mainfrom
agent/linked-hash-map

Conversation

@dlunch

Copy link
Copy Markdown
Owner

Summary

  • add the CDC 1.1 java.util.LinkedHashMap public API
  • preserve insertion or access order across map views with live fail-fast iterators
  • support map copies, rehashing, null mappings, iterator removal, and removeEldestEntry policies
  • extend HashMap with load-factor handling, modification tracking, and internal subclass hooks
  • document that Java compatibility work must use public specifications, Javadocs, and observable behavior rather than runtime implementation source

Validation

  • cargo fmt --all -- --check
  • git diff --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test -p java_runtime (468 passed)
  • cargo test --workspace (531 passed, 1 existing ignored)

CopilotAI lite review requested due to automatic review settings August 9, 2026 08:11
@codecov

codecovBot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.31903% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.74%. Comparing base (c92a32a) to head (bd46e1e).

Files with missing linesPatch %Lines
...a_runtime/src/classes/java/util/linked_hash_map.rs93.63%17 Missing ⚠️
.../java/util/linked_hash_map_linked_hash_iterator.rs96.38%3 Missing ⚠️
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.
📢 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 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/LinkedHashMap plus ordered entry nodes and iterator types (key/value/entry) backed by a linked-list header sentinel.
  • Extend java/util/HashMap with 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
FileDescription
java_runtime/tests/classes/java/util/test_linked_hash_map.rsAdds 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.rsRegisters the new LinkedHashMap test module.
java_runtime/src/loader.rsRegisters LinkedHashMap and its nested runtime classes in the class proto loader.
java_runtime/src/classes/java/util/linked_hash_map.rsImplements java/util/LinkedHashMap constructors, order-preserving storage, access-order get, and iterator factories.
java_runtime/src/classes/java/util/linked_hash_map_entry.rsImplements 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.rsImplements the shared ordered, fail-fast iterator base for LinkedHashMap views.
java_runtime/src/classes/java/util/linked_hash_map_key_iterator.rsKey iterator specialization over ordered entries.
java_runtime/src/classes/java/util/linked_hash_map_value_iterator.rsValue iterator specialization over ordered entries.
java_runtime/src/classes/java/util/linked_hash_map_entry_iterator.rsEntry iterator specialization returning Map.Entry objects.
java_runtime/src/classes/java/util/hash_map.rsRefactors 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.rsUpdates Values view iteration/removal to use entryIterator/valueIterator hooks.
java_runtime/src/classes/java/util/hash_map_key_set.rsUpdates KeySet iterator to use the keyIterator hook.
java_runtime/src/classes/java/util/hash_map_entry_set.rsUpdates EntrySet iterator to use the entryIterator hook.
java_runtime/src/classes/java/util/hash_map_entry.rsAdds entry lifecycle hooks (onAccess, onRemoval) and ensures public accessors align with public API usage.
java_runtime/src/classes/java/util.rsWires new util module files into the build and re-exports the new types.
AGENTS.mdDocuments 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.

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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.

💡 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".

Comment threadjava_runtime/src/classes/java/util/linked_hash_map_entry.rs
Comment threadjava_runtime/src/classes/java/util/hash_map.rs
@dlunch
dlunch merged commit 5fbb27b into mainAug 9, 2026
15 checks passed
@dlunch
dlunch deleted the agent/linked-hash-map branch August 9, 2026 09:38
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