RFC (csr): 8221528: Introduce compatibility mode with VM option -XX:AllowRedefinitionToAddOrDeleteMethods

Alan Bateman Alan.Bateman at oracle.com
Thu Mar 28 11:36:56 UTC 2019


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



More information about the serviceability-dev mailing list