This repository was archived by the owner on Feb 2, 2026. It is now read-only.
修复access-inline插件遇到access$方法中只有LDC指令时的NPE问题#42
Open
Xiaojuanmao wants to merge 2 commits intobytedance:masterfrom
Open
修复access-inline插件遇到access$方法中只有LDC指令时的NPE问题#42Xiaojuanmao wants to merge 2 commits intobytedance:masterfrom
Xiaojuanmao wants to merge 2 commits intobytedance:masterfrom
Conversation
Contributor
|
感谢反馈。我本地已经复现了,const_inline插件破坏了标准了access方法指令,这里access方法判断不严谨。 |
Author
|
Author
|
大佬,pull request 求看一眼 Orz |
Author
|
还有一个对插件的思考,const-inline不会对带有PUT_STATIC指令操作的进行优化,(上面例子中的ARG_1理论上是可以优化的,也被忽略了),从字节码的角度过滤可能成本比较大,可以把这些情况做一个扫描上报,如果优化空间较大,可以从代码规范的角度来做(把ARG_1的写法换成 private val const ARG_1 = 1) |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
复现步骤
原因分析
Context.prepare()方法,由于target为null导致PreProcessClassVisitor.refine()方法执行时设置,但在处理access$方法中只包含LDC指令时,会出现没有设置target的情况。(经过const-inline插件优化过后,ARG_2 参数access$方法中的GET STATIC -> LDC)private val本不应该被const-inline识别并处理,目前看来由于赋值的是默认值0,ARG_2成了编译期常量处理
跳过包含LDC指令的
access$方法内联