Skip to content

Fix cn1playground class-name collisions for UIManager/Display globals#4698

Merged
liannacasper merged 3 commits intomasterfrom
codex/fix-uimanager-getinstance-error
Apr 4, 2026
Merged

Fix cn1playground class-name collisions for UIManager/Display globals#4698
liannacasper merged 3 commits intomasterfrom
codex/fix-uimanager-getinstance-error

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Motivation

  • User scripts that import com.codename1.ui.plaf.UIManager and call UIManager.getInstance() were failing because the runner injected global variables named UIManager and Display that shadowed the class names and caused instance dispatch to be attempted instead of static class dispatch.
  • Add a regression to ensure future changes do not reintroduce the class-name collision.

Description

  • Change PlaygroundRunner.bindGlobals() to expose instance helpers as lowercase names display and uiManager instead of Display and UIManager so imported CN1 classes are not shadowed.
  • Add smokeUIManagerClassImportDoesNotCollideWithGlobals() to PlaygroundSmokeHarness which imports com.codename1.ui.plaf.UIManager, calls UIManager.getInstance(), checks isThemeConstant("PopupDialogArrowBool", false), constructs an InteractionDialog and verifies the script evaluates to a Container.
  • Hook the new smoke regression into the harness main() so it runs with the other playground smoke checks.

Testing

  • Ran the playground smoke script runner ./tools/run-playground-smoke-tests.sh, which failed in this environment due to inability to download release source jars from Maven Central (HTTP 403), preventing regeneration of the CN1 access registry and full smoke execution.
  • Attempted mvn -pl common -DskipTests test-compile and mvn ... exec:java -Dexec.mainClass=com.codenameone.playground.PlaygroundSmokeHarness, both of which failed with plugin/artifact resolution errors caused by Maven Central returning HTTP 403, so the regression could not be executed here.
  • Added the regression test so CI (or a local environment with network access and required artifacts) can validate the fix once dependencies are available.

Codex Task

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

Cloudflare Preview

@liannacasper liannacasper linked an issue Apr 4, 2026 that may be closed by this pull request
@liannacasper liannacasper merged commit ebc404f into master Apr 4, 2026
9 checks passed
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.

Playground UIManager Bug

1 participant