On 28/03/2019 10:19, Michael Rasmussen wrote:
It was my assumption that the reason adding private methods were allowed with 
redefineClass was to support adding/removing lambdas from method bodies, since 
javac converts those into private methods.

It came about in JDK 6 as part of the effort to instrument native methods. The intention, in Java SE 6, was to provide a way for JVM TI and java agents to wrap native methods at load time. The SetNativeMethodPrefix function in the JVM TI spec documents this feature. Somehow, there was an attempt to get do the equivalent for late binding agents but that has massive implications, not just the JVM TI spec, but to wide areas of the platform. I see the VM option as a pragmatic approach to allow the mistake be removed over time and to give time for agent writers that might be using this to show up with their use-cases if it's anything other than instrumenting native methods.

-Alan

Reply via email to