I've got that public void shutdown() throws IOException {...} in a third-party library, and I want to modify it so that it additionally does a call like System.out.println("ho hum"); right before its normal activity.
In a sense, we have the trivial case: The class is known not to be loaded yet, so I could load the class file as a resource, run it through ByteBuddy to inser that println call, then feed the resulting file to the current ClassLoader and all should be fine.
However, I don't seem to be able to find the relevant API (I can't use premain since creating an agent jar with a premain function would break our build process).
So, what would be the right approach for that?