6373396: (cl spec) clarify spec of ClassLoader.getPackages() about run-time package

Reviewed-by: psandoz
This commit is contained in:
Mandy Chung 2017-09-27 12:44:06 -07:00
parent 999343e352
commit 24d81d3f2e

View file

@ -2160,10 +2160,12 @@ public abstract class ClassLoader {
* if a package of the given {@code name} is already * if a package of the given {@code name} is already
* defined by this class loader * defined by this class loader
* *
*
* @since 1.2 * @since 1.2
* @revised 9 * @revised 9
* @spec JPMS * @spec JPMS
* *
* @jvms 5.3 Run-time package
* @see <a href="{@docRoot}/../specs/jar/jar.html#sealing"> * @see <a href="{@docRoot}/../specs/jar/jar.html#sealing">
* The JAR File Specification: Package Sealing</a> * The JAR File Specification: Package Sealing</a>
*/ */
@ -2186,17 +2188,19 @@ public abstract class ClassLoader {
} }
/** /**
* Returns a {@code Package} of the given <a href="#name">name</a> that has been * Returns a {@code Package} of the given <a href="#name">name</a> that
* defined by this class loader. * has been defined by this class loader.
* *
* @param name The <a href="#name">package name</a> * @param name The <a href="#name">package name</a>
* *
* @return The {@code Package} of the given name defined by this class loader, * @return The {@code Package} of the given name that has been defined
* or {@code null} if not found * by this class loader, or {@code null} if not found
* *
* @throws NullPointerException * @throws NullPointerException
* if {@code name} is {@code null}. * if {@code name} is {@code null}.
* *
* @jvms 5.3 Run-time package
*
* @since 9 * @since 9
* @spec JPMS * @spec JPMS
*/ */
@ -2211,14 +2215,18 @@ public abstract class ClassLoader {
} }
/** /**
* Returns all of the {@code Package}s defined by this class loader. * Returns all of the {@code Package}s that have been defined by
* The returned array has no duplicated {@code Package}s of the same name. * this class loader. The returned array has no duplicated {@code Package}s
* of the same name.
* *
* @apiNote This method returns an array rather than a {@code Set} or {@code Stream} * @apiNote This method returns an array rather than a {@code Set} or {@code Stream}
* for consistency with the existing {@link #getPackages} method. * for consistency with the existing {@link #getPackages} method.
* *
* @return The array of {@code Package} objects defined by this class loader; * @return The array of {@code Package} objects that have been defined by
* or an zero length array if no package has been defined by this class loader. * this class loader; or an zero length array if no package has been
* defined by this class loader.
*
* @jvms 5.3 Run-time package
* *
* @since 9 * @since 9
* @spec JPMS * @spec JPMS
@ -2244,7 +2252,7 @@ public abstract class ClassLoader {
* @param name * @param name
* The <a href="#name">package name</a> * The <a href="#name">package name</a>
* *
* @return The {@code Package} corresponding to the given name defined by * @return The {@code Package} of the given name that has been defined by
* this class loader or its ancestors, or {@code null} if not found. * this class loader or its ancestors, or {@code null} if not found.
* *
* @throws NullPointerException * @throws NullPointerException
@ -2263,6 +2271,8 @@ public abstract class ClassLoader {
* {@link ClassLoader#getDefinedPackage} method which returns * {@link ClassLoader#getDefinedPackage} method which returns
* a {@code Package} for the specified class loader. * a {@code Package} for the specified class loader.
* *
* @see ClassLoader#getDefinedPackage(String)
*
* @since 1.2 * @since 1.2
* @revised 9 * @revised 9
* @spec JPMS * @spec JPMS
@ -2281,10 +2291,10 @@ public abstract class ClassLoader {
} }
/** /**
* Returns all of the {@code Package}s defined by this class loader * Returns all of the {@code Package}s that have been defined by
* and its ancestors. The returned array may contain more than one * this class loader and its ancestors. The returned array may contain
* {@code Package} object of the same package name, each defined by * more than one {@code Package} object of the same package name, each
* a different class loader in the class loader hierarchy. * defined by a different class loader in the class loader hierarchy.
* *
* @apiNote The {@link #getPlatformClassLoader() platform class loader} * @apiNote The {@link #getPlatformClassLoader() platform class loader}
* may delegate to the application class loader. In other words, * may delegate to the application class loader. In other words,
@ -2294,8 +2304,10 @@ public abstract class ClassLoader {
* when invoked on the platform class loader, this method will not * when invoked on the platform class loader, this method will not
* return any packages defined to the application class loader. * return any packages defined to the application class loader.
* *
* @return The array of {@code Package} objects defined by this * @return The array of {@code Package} objects that have been defined by
* class loader and its ancestors * this class loader and its ancestors
*
* @see ClassLoader#getDefinedPackages()
* *
* @since 1.2 * @since 1.2
* @revised 9 * @revised 9