< prev index next >

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

Print this page

        

@@ -130,18 +130,21 @@
     String osName;
     String osArch;
     String osVersion;
     String algorithm;
     Map<String, byte[]> hashes;
+    boolean doNotResolveByDefault;
+    WarnIfResolvedReason warnIfResolvedReason;
 
     Builder(String name) {
         this.name = name;
         this.requires = Collections.emptySet();
         this.exports = Collections.emptySet();
         this.opens = Collections.emptySet();
         this.provides = Collections.emptySet();
         this.uses = Collections.emptySet();
+        warnIfResolvedReason = WarnIfResolvedReason.NONE;
     }
 
     Builder open(boolean value) {
         this.open = value;
         return this;

@@ -292,10 +295,26 @@
         hashes.put(mn, hash);
         return this;
     }
 
     /**
+     * Sets module DO_NOT_RESOLVE_BY_DEFAULT.
+     */
+    public Builder doNotResolveByDefault(boolean doNotResolveByDefault) {
+        this.doNotResolveByDefault = doNotResolveByDefault;
+        return this;
+    }
+
+    /**
+     * Sets module WARN_IF_RESOLVED.
+     */
+    public Builder warnIfResolved(WarnIfResolvedReason reason) {
+        this.warnIfResolvedReason = reason;
+        return this;
+    }
+
+    /**
      * Builds a {@code ModuleDescriptor} from the components.
      */
     public ModuleDescriptor build(int hashCode) {
         assert name != null;
 

@@ -316,8 +335,10 @@
                                         osName,
                                         osArch,
                                         osVersion,
                                         packages,
                                         moduleHashes,
-                                        hashCode);
+                                        hashCode,
+                                        doNotResolveByDefault,
+                                        warnIfResolvedReason);
     }
 }
< prev index next >