Skip to content

Fix @HostRefParam with array/varargs parameters#176

Merged
andreaTP merged 1 commit into
roastedroot:mainfrom
andreaTP:fix/hostref-array-varargs
Jun 12, 2026
Merged

Fix @HostRefParam with array/varargs parameters#176
andreaTP merged 1 commit into
roastedroot:mainfrom
andreaTP:fix/hostref-array-varargs

Conversation

@andreaTP

Copy link
Copy Markdown
Collaborator

When JavaScript passes an array of HostRef pointers (e.g. [ptr1, ptr2]) to a Java @HostRefParam varargs parameter, Engine.invokeBuiltin() called ArrayNode.intValue() which silently returns 0, resolving the wrong object.

  • Engine: detect ArrayNode and resolve each element individually
  • BuiltinsProcessor: use TypeKind.ARRAY to detect array @HostRefParam and generate List-to-typed-array conversion in the lambda

When JavaScript passes an array of HostRef pointers (e.g. [ptr1, ptr2])
to a Java @HostRefParam varargs parameter, Engine.invokeBuiltin() called
ArrayNode.intValue() which silently returns 0, resolving the wrong object.

- Engine: detect ArrayNode and resolve each element individually
- BuiltinsProcessor: use TypeKind.ARRAY to detect array @HostRefParam
  and generate List-to-typed-array conversion in the lambda

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@andreaTP andreaTP force-pushed the fix/hostref-array-varargs branch from 3ef3ce9 to d9603eb Compare June 12, 2026 11:19
@andreaTP

Copy link
Copy Markdown
Collaborator Author

Found by @lbroudoux

@andreaTP andreaTP merged commit c625333 into roastedroot:main Jun 12, 2026
4 checks passed
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.

1 participant