This option enables and disables the storage of VM anonymous classes, those created by Unsafe.defineAnonymousClass, in the shared classes cache.

The option is enabled by default, which means that anonymous classes are stored in the shared classes cache and are therefore available for ahead-of-time (AOT) compilation, potentially improving startup performance.


Setting Effect Default
-XX:+ShareAnonymousClasses Enable yes
-XX:-ShareAnonymousClasses Disable

See also