Skip to content

Issue apache#2909 Document stream fields as wrapped Java objects in the JavaScript transform - #8166

Merged
hansva merged 1 commit into
apache:mainfrom
sramazzina:doc-2909-javascript-stream-fields
Aug 29, 2026
Merged

Issue apache#2909 Document stream fields as wrapped Java objects in the JavaScript transform#8166
hansva merged 1 commit into
apache:mainfrom
sramazzina:doc-2909-javascript-stream-fields

Conversation

@sramazzina

@sramazzina sramazzina commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Stream fields are added to the Rhino scope through Context.toObject(), so they reach the script as wrapped Java objects instead of JavaScript primitives. This makes a Boolean field always truthy and makes == / != between two fields compare object identity rather than values.

Add a "Stream fields are Java objects" section to the JavaScript transform documentation describing the behaviour and the .valueOf() / parseInt() workarounds, including the null-safety check.

Fixes #2909


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Run mvn clean install apache-rat:check to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If you have a group of commits related to the same change, please squash your commits into one and force push your branch using git rebase -i.
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

…sform

Stream fields are added to the Rhino scope through Context.toObject(), so
they reach the script as wrapped Java objects instead of JavaScript
primitives. This makes a Boolean field always truthy and makes == / !=
between two fields compare object identity rather than values.

Add a "Stream fields are Java objects" section to the JavaScript transform
documentation describing the behaviour and the .valueOf() / parseInt()
workarounds, including the null-safety check.
@hansva
hansva merged commit ee730a3 into apache:main Aug 29, 2026
2 checks passed
@sramazzina
sramazzina deleted the doc-2909-javascript-stream-fields branch August 31, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different behaviour of JavaScript step on boolean variables depending on source

2 participants