JVMTI ClassFileLoadHook

Alan Bateman Alan.Bateman at oracle.com
Sun Feb 16 08:47:53 UTC 2020


On 15/02/2020 12:52, Peter Hull wrote:
> In the JVM Tool Interface there is an event for Class File Loading. In
> the docs (https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#ClassFileLoadHook)
> it says that the 'name' parameter can be NULL"if the class is defined
> with a NULL name or without a name specified". Under what
> circumstances can the class be defined like this?
The class name may not be known in advance when presenting a class file 
to the VM. Skim through the defineClass methods that ClassLoader 
specified for examples. If the name is provided then the agent's CFLH 
needs to be defensive as it can't trust it for the class load 
(class_being_redefined == NULL) case. Best to follow-up on 
serviceability-dev if there are issues.

-Alan.


More information about the discuss mailing list