Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教一个Asm插装的问题 #48

Closed
ethanhua opened this issue Sep 14, 2021 · 3 comments
Closed

请教一个Asm插装的问题 #48

ethanhua opened this issue Sep 14, 2021 · 3 comments

Comments

@ethanhua
Copy link

ethanhua commented Sep 14, 2021

你的库很赞
比如我想要替换一行代码如下:

原始代码: A a = new A(param1,param2,....),

替换成: A a = B.newC(params1,param2,....) , 其中B中的newC方法是静态方法,class C extends A

使用asm core api该如何做?

@Leifzhang
Copy link
Owner

core api 就用classvisitor的 method visitor 逐行替换就好了,因为不涉及的参数变更 所以只要进行匹配就行了 可以参考类似privacy那部分替换逻辑

@ethanhua
Copy link
Author

原始代码: A a = new A(param1,param2,....),

替换成: A a = B.newC(params1,param2,....) , 其中B中的newC方法是静态方法,class C extends A, 如果是这种场景该怎么替换 有具体的例子可以参考吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants