Fix instance field resolution and storage across inheritance - #207
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
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
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/putfieldthroughJvm::{get,put}_field_from_class, using the constant-pool field reference’s class for resolution. - Include the declaring class in
FieldImplidentity 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.

Summary
Jvm::get_field/put_fieldand update interpreter and runtime callers.Fieldintegration fixture to cover hidden and inherited fields.Verification