修复access-inline插件遇到access$方法中只有LDC指令时的NPE问题 #42
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$
方法内联