Byte Buddy能够使用advice方法来处理程序中的”==”, “!=”, “<", ">“等操作符吗?

huangapple go评论68阅读模式
英文:

Can Byte Buddy use the advice method to handle things like "==", "!=", "<", ">" in the program?

问题

我想在Java程序中使用Byte Buddy的advice方法来监视以下比较操作,例如

"1<2", "3>2", "param1!=null", "param3==param2"

这些比较操作可以使用Byte Buddy进行监视吗?例如使用

@Advice.OnMethodEnter

如果可能的话,是否有参考的示例代码?

英文:

I want to use Byte Buddy's advice method in a Java program to monitor the following comparisons, such as

&quot;1&lt;2&quot;, &quot;3&gt;2&quot;, &quot;param1!=null&quot;, &quot;param3==param2&quot;

Can these comparison operators be monitored with Byte Buddy? Such as using

@Advice.OnMethodEnter

If it is possible, is there any sample code for reference?

答案1

得分: 0

建议无法做到这一点。通常情况下,将目标定为代码变动这样详细的元素并不太有意义,因为代码经常变动,但您需要使用 ASM 来操纵这样的代码。

英文:

Advice is not capable of this. Normally, it does not make much sense to aim for such detailed elements as code changes to frequently, but you would need to use ASM to manipulate such code.

huangapple
  • 本文由 发表于 2023年6月1日 15:54:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76379777.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定