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.
修正动态绑定机制导致方法调用产生的误报问题
问题介绍:
https://droidyue.com/blog/2014/12/28/static-biding-and-dynamic-binding-in-java/
测试中我编写了这样的三个具有继承关系的类以及一个测试类,且其中一个子类方法进行了重写,
以下是生成的Jimple,可以发现如果仅考虑调用语句的方法签名会导致生成错误的调用关系
解决方案
该问题只会在virtual invoke中发生,因此在我修改的代码中仅对该情况进行了考虑:
修改前:
修改后