--- old/src/jdk.jdi/share/classes/com/sun/jdi/ClassLoaderReference.java 2020-04-12 17:30:07.000000000 -0700 +++ new/src/jdk.jdi/share/classes/com/sun/jdi/ClassLoaderReference.java 2020-04-12 17:30:07.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,26 +42,44 @@ public interface ClassLoaderReference extends ObjectReference { /** - * Returns a list of all loaded classes that were defined by this - * class loader. No ordering of this list guaranteed. - *

- * The returned list will include reference types - * loaded at least to the point of preparation and - * types (like array) for which preparation is - * not defined. + * Returns a list of all classes defined by this class loader. + * No ordering of this list guaranteed. + * The returned list will include all reference types, including + * {@link Class#isHidden hidden classes or interfaces}, loaded + * at least to the point of preparation and types (like array) + * for which preparation is not defined. * - * @return a List of {@link ReferenceType} objects mirroring types - * loaded by this class loader. The list has length 0 if no types + * @return a {@code List} of {@link ReferenceType} objects mirroring types + * defined by this class loader. The list has length 0 if no types * have been defined by this classloader. */ List definedClasses(); /** - * Returns a list of all classes for which this class loader has - * been recorded as the initiating loader in the target VM. - * The list contains ReferenceTypes defined directly by this loader - * (as returned by {@link #definedClasses}) and any types for which - * loading was delegated by this class loader to another class loader. + * Returns a list of all classes which this class loader + * can find by name via {@link ClassLoader#loadClass(String, boolean) + * ClassLoader::loadClass}, {@link Class#forName(String) Class::forName} + * and bytecode linkage in the target VM. That is, this class loader + * has been recorded as an initiating loader of these classes. + *

+ * Each class in the returned list was created by this class loader + * either by defining it directly or by delegation to another class loader + * (see JVMS {@jvms 5.3}). + * + * The returned list 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: + *

+ *

+ * In addition, the returned list does not include array classes whose + * {@linkplain ArrayType#componentType() element type} is a + * {@link Class#isHidden() hidden class or interface} as they cannot + * be discovered by this class loader. *

* The visible class list has useful properties with respect to * the type namespace. A particular type name will occur at most @@ -71,11 +89,6 @@ *

* No ordering of the returned list is guaranteed. *

- * See - * The Java™ Virtual Machine Specification, - * section 5.3 - Creation and Loading - * for more information on the initiating classloader. - *

* Note that unlike {@link #definedClasses()} * and {@link VirtualMachine#allClasses()}, * some of the returned reference types may not be prepared. @@ -85,9 +98,11 @@ * Use {@link ReferenceType#isPrepared()} to determine if * a reference type is prepared. * - * @return a List of {@link ReferenceType} objects mirroring classes - * initiated by this class loader. The list has length 0 if no classes - * are visible to this classloader. + * @return a {@code List} of {@link ReferenceType} objects mirroring + * classes which this class loader can find by name. The list + * has length 0 if no classes are visible to this classloader. + * + * @jvms 5.3 Creation and Loading */ List visibleClasses(); }