--- old/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java 2020-04-13 21:03:58.000000000 -0700 +++ new/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java 2020-04-13 21:03:57.000000000 -0700 @@ -388,6 +388,28 @@ /** * Returns an array of all classes currently loaded by the JVM. * + *
+ * A class or interface creation can be triggered by one of the following: + *
+ * An array class is created directly by Java virtual machine. An array + * class creation can be triggered by using class loaders or by invoking + * methods in certain reflection APIs such as + * {@link java.lang.reflect.Array#newInstance(Class, int) Array::newInstance} + * and {@link Class#arrayType() Class::arrayType}. + *
+ * The returned array includes all classes and interfaces, including
+ * {@link Class#isHidden hidden classes or interfaces}, and array classes
+ * of all types.
+ *
* @return an array containing all the classes loaded by the JVM, zero-length if there are none
*/
@SuppressWarnings("rawtypes")
@@ -395,12 +417,30 @@
getAllLoadedClasses();
/**
- * Returns an array of all classes for which loader
is an initiating loader.
- * If the supplied loader is null
, classes initiated by the bootstrap class
- * loader are returned.
+ * Returns an array of all classes which {@code loader} can find by name
+ * via {@link ClassLoader#loadClass(String, boolean) ClassLoader::loadClass},
+ * {@link Class#forName(String) Class::forName} and bytecode linkage.
+ * That is, {@code loader} has been recorded as an initiating loader
+ * of these classes. If the supplied {@code loader} is {@code null},
+ * classes that the bootstrap class loader can find by name are returned.
+ *
+ *
+ * The returned array does not include {@link Class#isHidden() + * hidden} classes or interfaces that are created by the invocation of + * {@link java.lang.invoke.MethodHandles.Lookup#defineHiddenClass(byte[], boolean, java.lang.invoke.MethodHandles.Lookup.ClassOption...) + * Lookup::defineHiddenClass} because: + *