changeset 18796:10d2eed8afee

Further clarification to IAE for builder APIs that take a class name
author alanb
date Tue, 17 Jan 2017 15:10:04 +0000
parents d9e0f57b69f5
children e3ca86f882f8
files src/java.base/share/classes/java/lang/module/ModuleDescriptor.java src/java.base/share/classes/jdk/internal/module/Checks.java
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Tue Jan 17 12:56:06 2017 +0000
+++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Tue Jan 17 15:10:04 2017 +0000
@@ -1359,8 +1359,8 @@
      *
      * <p> The module names, package names, and class names that are parameters
      * specified to the builder methods are the module names, package names,
-     * and qualified names of classes as defined in the <cite>The Java&trade;
-     * Language Specification</cite>. </p>
+     * and qualified names of classes (in named packages) as defined in the
+     * <cite>The Java&trade; Language Specification</cite>. </p>
      *
      * <p> Example usage: </p>
      * <pre>{@code    ModuleDescriptor descriptor = ModuleDescriptor.newModule("stats.core")
@@ -1808,7 +1808,7 @@
          *
          * @throws IllegalArgumentException
          *         If the service type is {@code null} or not a qualified name of
-         *         a Java class
+         *         a Java class in a named package
          * @throws IllegalStateException
          *         If a dependency on the service type has already been declared
          *          or this is a builder for an an automatic module
@@ -1861,8 +1861,8 @@
          *
          * @throws IllegalArgumentException
          *         If the service type or any of the provider class names is
-         *         {@code null} or not a qualified name of a Java class, or
-         *         the list of provider class names is empty
+         *         {@code null} or not a qualified name of a Java class in a
+         *         named package, or the list of provider class names is empty
          * @throws IllegalStateException
          *         If the providers for the service type have already been
          *         declared
@@ -1959,7 +1959,7 @@
          *
          * @throws IllegalArgumentException
          *         If {@code mainClass} is {@code null} or not a qualified
-         *         name of a Java class
+         *         name of a Java class in a named package
          */
         public Builder mainClass(String mc) {
             String pn;
--- a/src/java.base/share/classes/jdk/internal/module/Checks.java	Tue Jan 17 12:56:06 2017 +0000
+++ b/src/java.base/share/classes/jdk/internal/module/Checks.java	Tue Jan 17 15:10:04 2017 +0000
@@ -116,16 +116,17 @@
     }
 
     /**
-     * Checks a name to ensure that it's a legal qualified class name.
+     * Checks a name to ensure that it's a legal qualified class name in
+     * a named package.
      *
      * @throws IllegalArgumentException if name is null or not a legal
-     *         qualified class name
+     *         qualified class name in a named package
      */
     public static String requireQualifiedClassName(String what, String name) {
         requireTypeName(what, name);
         if (name.indexOf('.') == -1)
-            throw new IllegalArgumentException(name
-                    + ": is not a qualified name of a Java class");
+            throw new IllegalArgumentException(name + ": is not a qualified name of"
+                                               + " a Java class in a named package");
         return name;
     }