Skip to content

fix: wrap bp.log methods to add dummy param and lazy stringify (#241)#242

Open
Codergoterrors wants to merge 1 commit intobThink-BGU:developfrom
Codergoterrors:fix/log-dummy-param-and-lazy-stringify
Open

fix: wrap bp.log methods to add dummy param and lazy stringify (#241)#242
Codergoterrors wants to merge 1 commit intobThink-BGU:developfrom
Codergoterrors:fix/log-dummy-param-and-lazy-stringify

Conversation

@Codergoterrors
Copy link
Copy Markdown

Fixes #241

Changes

  • globalScopeInit.js: Added a JS-level wrapper around bp.log that:

    1. Always appends a dummy {} argument to every log call, preventing
      Java's varargs from misinterpreting a single array argument
    2. Lazily applies JSON.stringify to object params only when the
      log level means the message will actually be printed
  • BProgram.java: Activated globalScopeInit.js by loading it during
    setup() right after initProgramScope()

Testing

All 312 existing tests pass with 0 failures.

…k-BGU#241)

- Always append a dummy {} to log call args to prevent the
  single-array-param Java varargs misinterpretation issue
- JSON.stringify object params only when the log level is active
- Implemented as a JS wrapper in globalScopeInit.js, loaded at
  program scope initialization in BProgram.java
@michbarsinai michbarsinai self-assigned this Apr 9, 2026
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.

Logs: Always add a dummy object at the end to prevent the single-array-param issue

2 participants