< prev index next >

src/java.base/share/classes/jdk/internal/module/Builder.java

Print this page

        

@@ -191,11 +191,12 @@
      *
      * @see Version#parse(String)
      */
     public Builder version(String v) {
         if (version != null)
-            throw new IllegalStateException("module version already set");
+            throw new IllegalStateException(
+                "module version already set: " + version);
         Version ver = cachedVersion;
         if (ver != null && v.equals(ver.toString())) {
             version = ver;
         } else {
             cachedVersion = version = Version.parse(v);

@@ -208,11 +209,12 @@
      *
      * @throws IllegalStateException if already set
      */
     public Builder mainClass(String mc) {
         if (mainClass != null)
-            throw new IllegalStateException("main class already set");
+            throw new IllegalStateException(
+                "main class already set: " + mainClass);
         mainClass = mc;
         return this;
     }
 
     /**

@@ -220,11 +222,12 @@
      *
      * @throws IllegalStateException if already set
      */
     public Builder osName(String name) {
         if (osName != null)
-            throw new IllegalStateException("OS name already set");
+            throw new IllegalStateException(
+                "OS name already set: " + osName);
         this.osName = name;
         return this;
     }
 
     /**

@@ -232,11 +235,12 @@
      *
      * @throws IllegalStateException if already set
      */
     public Builder osArch(String arch) {
         if (osArch != null)
-            throw new IllegalStateException("OS arch already set");
+            throw new IllegalStateException(
+                "OS arch already set: " + osArch);
         this.osArch = arch;
         return this;
     }
 
     /**

@@ -244,11 +248,12 @@
      *
      * @throws IllegalStateException if already set
      */
     public Builder osVersion(String version) {
         if (osVersion != null)
-            throw new IllegalStateException("OS version already set");
+            throw new IllegalStateException(
+                "OS version already set: " + osVersion);
         this.osVersion = version;
         return this;
     }
 
     /**
< prev index next >