Skip to content

Fix instance field resolution and storage across inheritance - #207

Merged
dlunch merged 2 commits into
mainfrom
fix/instance-field-resolution
Sep 24, 2026
Merged

dlunch merged 2 commits into
mainfrom
fix/instance-field-resolution

Conversation

@dlunch

@dlunch dlunch commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Require an explicit class in Jvm::get_field / put_field and update interpreter and runtime callers.
  • Include the declaring class in field identity to keep same-name parent and child fields independent.
  • Extend the existing Field integration fixture to cover hidden and inherited fields.

Verification

  • Workspace tests passed (two existing ignored tests).
  • Formatting, workspace Clippy, and Wasm-target Clippy passed.

Copilot AI lite review requested due to automatic review settings September 23, 2026 23:42
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.48780% with 349 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.16%. Comparing base (21f54ff) to head (7e13a53).

Files with missing lines Patch % Lines
...va-runtime/src/classes/java/util/logging/logger.rs 54.90% 46 Missing ⚠️
...tjava-runtime/src/classes/java/util/linked_list.rs 85.36% 24 Missing ⚠️
...untime/src/classes/java/util/logging/log_record.rs 67.60% 23 Missing ⚠️
...ava-runtime/src/classes/java/text/number_format.rs 52.38% 20 Missing ⚠️
...me/src/classes/java/util/logging/stream_handler.rs 82.05% 14 Missing ⚠️
...ava-runtime/src/classes/java/io/buffered_reader.rs 87.12% 13 Missing ⚠️
...tjava-runtime/src/classes/java/text/date_format.rs 76.47% 12 Missing ⚠️
...a-runtime/src/classes/java/util/linked_hash_map.rs 88.78% 12 Missing ⚠️
...stjava-runtime/src/classes/java/io/print_writer.rs 73.80% 11 Missing ⚠️
...untime/src/classes/java/io/filter_output_stream.rs 50.00% 9 Missing ⚠️
... and 46 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #207      +/-   ##
==========================================
+ Coverage   86.96%   87.16%   +0.20%     
==========================================
  Files         308      308              
  Lines       44501    46319    +1818     
==========================================
+ Hits        38701    40375    +1674     
- Misses       5800     5944     +144     

☔ 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T00:11:46.324883Z 7e13a53 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

get_field/put_field currently borrow a temporary class name across an awaited async call, which can fail to compile and must be fixed.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

This PR fixes instance field resolution and per-field storage when a subclass hides a superclass field with the same name and descriptor—ensuring bytecode getfield/putfield resolve from the field reference’s declaring class and that hidden fields no longer alias the same storage slot.

Changes:

  • Route bytecode getfield/putfield through Jvm::{get,put}_field_from_class, using the constant-pool field reference’s class for resolution.
  • Include the declaring class in FieldImpl identity so hidden fields in an inheritance hierarchy have independent storage.
  • Extend the existing Field fixture to cover hidden boolean fields and independently-stored int/reference fields across Base/Derived/Leaf.
File Description
test-data/​src/​Field.java Expands the field fixture to cover hidden fields and access via different static types.
test-data/​Field.txt Updates expected output for the expanded fixture.
jvm/​src/​jvm.rs Adds {get,put}_field_from_class and routes host helpers through it.
jvm-bytecode/​src/​interpreter.rs Uses {get,put}_field_from_class for getfield/putfield using the fieldref class.
jvm-bytecode/​src/​field.rs Adds declaring_class to FieldImpl identity to prevent storage collisions.
jvm-bytecode/​src/​class_definition.rs Supplies declaring class when constructing fields from class protos/classfiles.

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

Comment thread jvm/src/jvm.rs Outdated
@dlunch
dlunch merged commit f7a7609 into main Sep 24, 2026
14 checks passed
@dlunch
dlunch deleted the fix/instance-field-resolution branch September 24, 2026 00:17
Sign up for free to 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