Is it possible to monkey patch in Java?

后端 未结 9 429
有刺的猬
有刺的猬 2020-12-09 16:40

I don\'t want to discuss the merits of this approach, just if it is possible. I believe the answer to be \"no\". But maybe someone will surprise me!

Imagine you have

9条回答
  •  有刺的猬
    2020-12-09 16:53

    Just my concept idea,

    It is possible that use AOP, with bytecode engineering way, to inject a aspect to the calculateHeight method.

    Then, you may enable you patch by ThreadLocal or else variable.

提交回复
热议问题