< prev index next >
src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java
Print this page
rev 58770 : [mq]: svc-spec-update
@@ -393,16 +393,34 @@
@SuppressWarnings("rawtypes")
Class[]
getAllLoadedClasses();
/**
- * Returns an array of all classes for which <code>loader</code> is an initiating loader.
- * If the supplied loader is <code>null</code>, 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.
+ *
+ * <p>
+ * The returned array does not include {@link Class#isHidden()
+ * <em>hidden</em>} 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:
+ * <ul>
+ * <li>A hidden class or interface cannot be referenced by the constant pools
+ * of other classes and interfaces.
+ * <li>A hidden class or interface cannot be discovered by any class loader.
+ * </ul>
+ * In addition, the returned array does not include array classes whose
+ * {@linkplain Class#componentType() element type} is a
+ * {@link Class#isHidden() hidden class or interface} as they cannot
+ * be discovered by {@code loader}.
*
* @param loader the loader whose initiated class list will be returned
- * @return an array containing all the classes for which loader is an initiating loader,
+ * @return an array containing all classes which {@code loader} can find by name;
* zero-length if there are none
*/
@SuppressWarnings("rawtypes")
Class[]
getInitiatedClasses(ClassLoader loader);
< prev index next >