fix: Lambda creation failed, fallback to parent's reflection implemen…#4012
Open
xihan123 wants to merge 4 commits into
Open
fix: Lambda creation failed, fallback to parent's reflection implemen…#4012xihan123 wants to merge 4 commits into
xihan123 wants to merge 4 commits into
Conversation
Member
|
单测跑不过,merge from main分支试下 |
… accessor creation fails
wenshao
approved these changes
Jun 22, 2026
wenshao
left a comment
Member
There was a problem hiding this comment.
代码逻辑正确,遵循了文件内已有的 catch (Throwable ignored) 异常处理惯例。编译和 core 模块测试均通过。建议后续补充回退路径的测试用例。LGTM ✅
— qwen3.7-max via Qwen Code /review
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.
What this PR does / why we need it?
修复 Android 环境下使用 JSON.parseObject、JSON.toJSONString 等方法时抛出的 NullPointerException。
在 Android 平台上,MethodHandles.Lookup.in() 方法可能返回 null,导致 Lambda 创建失败并抛出异常。此 PR 使 PropertyAccessorFactoryLambda 在 Lambda
创建失败时能够回退到父类的反射实现,而不是直接抛出异常导致程序崩溃。
Fixes #4011
Summary of your change
修改 PropertyAccessorFactoryLambda.create() 方法,在 Lambda 创建逻辑外层添加 try-catch 块。当 Lambda 创建失败(抛出 Throwable)时,捕获异常并忽略,然后继续执行到最后的
return super.create(...) 语句,回退到父类的反射实现。
Please indicate you've done the following: