Add List support for Jawk variables#469
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2425661ddc
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
This PR adds first-class support for passing Java List values into embedded Jawk executions by materializing lists as AWK associative arrays keyed by zero-based Long indices, including recursive handling of nested Map/List structures. It integrates normalization into variable injection paths (including JSR-223 bindings) and documents the behavior.
Changes:
- Introduces
ListAssocArrayplusAssocArrayfactory/normalization helpers to convertListvalues (and nested lists inside maps) into AWK arrays. - Normalizes injected variables inside
AVMexecution setup andassignVariable(...)soList/nested structures work across settings, overrides, and persistent globals. - Adds unit tests and updates documentation (README + site docs) to describe list materialization and nested traversal.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/io/jawk/jrt/ListAssocArray.java | New implementation for list-to-assoc-array materialization and recursive normalization of nested containers. |
| src/main/java/io/jawk/jrt/AssocArray.java | Adds createFromList(...) and normalizeValue(...) entry points for list support. |
| src/main/java/io/jawk/backend/AVM.java | Normalizes variable values during initialization, overrides, persistent seeding, and assignment to support List injection. |
| src/main/java/io/jawk/jsr223/JawkScriptEngine.java | Allows List values to pass the binding-value filter for JSR-223 variable overrides. |
| src/main/java/io/jawk/util/AwkSettings.java | Updates Javadoc to document List support and zero-based Long indexing behavior. |
| src/test/java/io/jawk/AssocArrayTest.java | Adds coverage for list materialization, nested map/list normalization, and list injection behavior. |
| src/test/java/io/jawk/ScriptEngineTest.java | Adds a JSR-223 test verifying list bindings are accepted and index as expected. |
| src/site/markdown/java-variables.md | Documents list materialization semantics and nested traversal for Java-supplied variables. |
| README.md | Updates top-level README to mention Map/List Java variable support and zero-based list indexing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex Please review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
Listvalues into embedded Jawk scripts.Longindexes while preserving directMaphandling.Map/Listobject trees and document the behavior in README and site docs.Testing
AssocArray,AVM-driven variable injection, andJawkScriptEnginelist bindings.