Fix JavaScript port pipeline: guard initImpl against getClass/getName failures in ParparVM translation#4719
Merged
shai-almog merged 1 commit intojavascript-port-initial-workfrom Apr 7, 2026
Conversation
…remove bogus file - Add port.js shim for CodenameOneImplementation.initImpl to handle getClass().getName() failures in ParparVM JS translation - Simplify ParparVMBootstrap.bootstrap() to match JavaScriptPortBootstrap (remove intermediate hasNativeTheme/installNativeTheme calls) - Remove bogus root-level ParparVMBootstrap.java with incorrect imports - Update STATUS.md with fix descriptions Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/450e96a0-a954-4d81-b2c3-4743d2b2bbe3 Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
shai-almog
April 7, 2026 18:57
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The JavaScript pipeline times out waiting for
CN1SS:SUITE:FINISHEDbecause aTypeError: Cannot read properties of null (reading '__classDef')duringDisplay.init()kills the main thread in the ParparVM drain scheduler. The error originates inCodenameOneImplementation.initImpl(Object m)which callsm.getClass().getName()thensubstring(0, lastIndexOf('.'))— in the ParparVM JS translation,getClass()can return null orgetName()returns underscore-separated names with no dots, and the resulting TypeError bypasses Javacatch(Throwable)blocks (which only catch Java exceptions, not raw JS errors).Changes
port.js— AddedbindCiFallbackshim forinitImplthat wraps the original method; on__classDef/substring/lastIndexOferrors, recovers by derivingpackageNamefrom the object's__classmetadata and setting theinitiailizedflag directly (note: field name matches the existing typo inCodenameOneImplementation.java:158)ParparVMBootstrap.java— Simplifiedbootstrap()to matchJavaScriptPortBootstrap.bootstrap()structure. RemovedhasNativeTheme()/installNativeTheme()calls betweenDisplay.init()andbootstrap.run()that made additional virtual dispatch calls on partially-initialized stateRoot
ParparVMBootstrap.java— Deleted bogus file with wrong imports (com.codename1.impl.javase.HTML5Implementation)Key detail: why Java catch doesn't help
The ParparVM
drain()scheduler runs generators viathread.generator.next()inside a JS-leveltry/catch. A rawTypeErrorfrom null virtual dispatch (obj.__classDef) is not a JavaThrowable— it has no__class/__classDefproperties — so translatedcatch(Throwable)blocks rethrow it, and it propagates todrain()which callsjvm.fail(err)and abandons the thread.