java.lang.System.currentTimeMillis() replace method

前端 未结 4 1514
-上瘾入骨i
-上瘾入骨i 2020-11-30 11:33

Aside from recompiling rt.jar is there any way I can replace the currentTimeMillis() call with one of my own?

1# The right way to

4条回答
  •  孤城傲影
    2020-11-30 11:58

    i've tried using javassist to remove the native currentTimeMills, add a pure java one and load it using bootclasspath/p, but i got the same exception access violation as you did. i believe that's probably because of the native method registerNatives that's called in the static block but it's really too much to disassemble the native library.

    so, instead of changing the System.currentTimeMills, how about changing the user code? if the user code already compiled (you don't have source code), we can use tools like findbugs to identify the use of currentTimeMillis and reject the code (maybe we can even replace the call to currentTimeMills with your own implementation).

提交回复
热议问题