Skip to content

Support multiple top-level class wrappers in Playground BeanShell runner#4715

Closed
liannacasper wants to merge 6 commits intomasterfrom
codex/add-support-for-multiple-classes-in-bsh-port
Closed

Support multiple top-level class wrappers in Playground BeanShell runner#4715
liannacasper wants to merge 6 commits intomasterfrom
codex/add-support-for-multiple-classes-in-bsh-port

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Motivation

  • Allow the Playground BeanShell runtime to accept scripts that declare multiple consecutive top-level classes and unwrap them into the script namespace rather than only a single top-level class.

Description

  • Extend unwrapSingleTopLevelClass to accumulate and unwrap consecutive top-level class bodies instead of rejecting when more than one top-level class exists.
  • Preserve existing safety checks by rejecting scripts with nested type declarations, non-whitespace code between class wrappers, or unsupported constructs, and continue to transformFieldDeclarations where needed.
  • Add smokeMultipleClassWrapperScript() to PlaygroundSmokeHarness and call it from main() to exercise a two-class script (Helpers + Demo).
  • Update the scripts/cn1playground/README.md text to reflect that top-level classes (plural) are unwrapped.

Testing

  • Attempted to run the playground smoke harness via ./tools/run-playground-smoke-tests.sh which failed due to environment constraints (missing Java 8 toolchain and local CN1 build client artifacts), so the script could not complete in this environment.
  • Ran mvn -pl common -am -DskipTests compile which reached the cn1playground-common build but failed during the CN1 bootstrap/download step because the environment could not fetch UpdateCodenameOne.jar (Network is unreachable) and a local cn1playground-ZipSupport artifact was missing.
  • No functional test failures were observed in the edited source files themselves; the remaining failures are environmental and unrelated to the implemented logic changes.

Codex Task

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

Cloudflare Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant