Skip to content

Add List support for Jawk variables#469

Merged
bertysentry merged 4 commits intomainfrom
458-add-support-for-list-in-variables-passed-to-jawk
May 6, 2026
Merged

Add List support for Jawk variables#469
bertysentry merged 4 commits intomainfrom
458-add-support-for-list-in-variables-passed-to-jawk

Conversation

@bertysentry
Copy link
Copy Markdown
Contributor

Summary

  • Add support for passing Java List values into embedded Jawk scripts.
  • Materialize lists as AWK arrays with zero-based Long indexes while preserving direct Map handling.
  • Support nested Map/List object trees and document the behavior in README and site docs.
  • Add unit coverage for list variables, nested map/list structures, and script engine bindings.

Testing

  • Added unit tests for AssocArray, AVM-driven variable injection, and JawkScriptEngine list bindings.
  • Verified the updated test suite with Maven unit tests and project verification.

@bertysentry bertysentry linked an issue May 5, 2026 that may be closed by this pull request
@bertysentry bertysentry requested a review from Copilot May 5, 2026 17:35
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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

Comment thread src/main/java/io/jawk/backend/AVM.java Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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 ListAssocArray plus AssocArray factory/normalization helpers to convert List values (and nested lists inside maps) into AWK arrays.
  • Normalizes injected variables inside AVM execution setup and assignVariable(...) so List/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.

Comment thread src/main/java/io/jawk/jrt/ListAssocArray.java
Comment thread src/main/java/io/jawk/jrt/ListAssocArray.java
@bertysentry bertysentry requested a review from Copilot May 5, 2026 21:14
@bertysentry
Copy link
Copy Markdown
Contributor Author

@codex Please review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ 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".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/main/java/io/jawk/backend/AVM.java
Comment thread src/main/java/io/jawk/backend/AVM.java
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/main/java/io/jawk/backend/AVM.java Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@bertysentry bertysentry merged commit 285c56d into main May 6, 2026
2 checks passed
@bertysentry bertysentry deleted the 458-add-support-for-list-in-variables-passed-to-jawk branch May 6, 2026 10:23
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.

Add support for List in variables passed to Jawk

2 participants