As far as I know, everything is an object in Java.
I am looking through the java JDK and am experimenting with creating a custom JDK that allows me to perform more debugging operations. For example, I can manipulate every object by changing the Object.java class.
My question is: do methods inherit a class from the JRE as well, so that I can modify this parent to eg. make a method save it’s most recently passed arguments?
Thanks.
If you only want to enhance debugging, you can start with looking at what JVMTI has to offer. Even before that, see if JDI, a much higher level (and therefore easier to use) API built on top of JVMTI suits your needs.
And although what you’re saying doesn’t sound possible in itself, a similar effect can be achieved by instrumentation, using a byte code manipulating library, like BCEL.
As for your specific example, if you want to record method invocations and their parameters, simply setting a breakpoint with JDI and then querying the call stack can do the trick.