fix(bundle-update): avoid nested-comment trigger in KDoc body#50
Open
huhuanming wants to merge 8 commits intomainfrom
Open
fix(bundle-update): avoid nested-comment trigger in KDoc body#50huhuanming wants to merge 8 commits intomainfrom
huhuanming wants to merge 8 commits intomainfrom
Conversation
Kotlin block comments nest, so a bare `**` inside a `/** ... */` KDoc (as in `web-embed/**`) is lexed as a nested comment opener. The outer closing `*/` then only decrements the depth to 1, causing the rest of the file — including `fun validateWebEmbedSha256` and `fun isDevSettingsEnabled` — to be swallowed as comment body until EOF. This manifested as four cascading Android release errors: `Missing '}'` at 990:6, `Unclosed comment` at file end, and two `Unresolved reference` errors for the swallowed function names. Rewrite the sentence to describe the traversal in prose instead of using a glob, which removes the `**` from the comment body and makes the file lex cleanly.
Allows SplitBundleLoaderModule and other external modules to invoke the three getCurrentBundle*JSBundle entry points via reflection with a null receiver. Without @JvmStatic the Kotlin `object` members are instance methods on the singleton, so Class.getMethod(...).invoke(null, ctx) throws NPE and OTA segment lookup silently falls back to APK assets.
…c-nested-comment # Conflicts: # CHANGELOG.md
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.
Summary
ReactNativeBundleUpdate.kt:992–998containedbundleDir/web-embed/**in the comment body. Kotlin block comments nest (unlike Java/C), so the lexer treated the/*inside/web-embed/**as opening a new comment level. The outer*/only decremented depth from 2 to 1, so every definition after this comment — includingfun validateWebEmbedSha256andfun isDevSettingsEnabled— was silently absorbed into a comment that never closes.:onekeyfe_react-native-bundle-update:compileReleaseKotlin:990:6 Syntax error: Missing '}'2032:1 Syntax error: Unclosed comment849:83 Unresolved reference 'isDevSettingsEnabled'984:14 Unresolved reference 'validateWebEmbedSha256'**glob is no longer in the comment body. No behavior change.Repro / verification
Minimal repro (16-line Kotlin file with the same comment):
kotlinc 2.3.21output on the pre-fix file:kotlincon the post-fix file: no lex/parse errors (only expectedunresolved referenceentries for Android/Facebook framework imports that aren't on the standalone classpath).Test plan
@onekeyfe/react-native-bundle-updatepatch version and publishapps/mobile/package.jsonin app-monorepo to the new versionrelease-androidonxand confirm:onekeyfe_react-native-bundle-update:compileReleaseKotlinpasses