< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java

Print this page

        

@@ -56,16 +56,20 @@
     private final Map<String, Set<String>> opens;
     private final boolean isSystem;
     private final URI location;
 
     protected Module(String name) {
+        this(name, null, false);
+    }
+
+    protected Module(String name, ModuleDescriptor descriptor, boolean isSystem) {
         super(name);
-        this.descriptor = null;
+        this.descriptor = descriptor;
         this.location = null;
         this.exports = Collections.emptyMap();
         this.opens = Collections.emptyMap();
-        this.isSystem = true;
+        this.isSystem = isSystem;
     }
 
     private Module(String name,
                    URI location,
                    ModuleDescriptor descriptor,

@@ -87,15 +91,15 @@
     public String name() {
         return descriptor != null ? descriptor.name() : getName();
     }
 
     public boolean isNamed() {
-        return true;
+        return descriptor != null;
     }
 
     public boolean isAutomatic() {
-        return descriptor.isAutomatic();
+        return descriptor != null && descriptor.isAutomatic();
     }
 
     public Module getModule() {
         return this;
     }

@@ -230,31 +234,19 @@
         }
     }
 
     private static class UnnamedModule extends Module {
         private UnnamedModule() {
-            super("unnamed", null, null,
-                  Collections.emptyMap(), Collections.emptyMap(),
-                  false, null);
+            super("unnamed", null, false);
         }
 
         @Override
         public String name() {
             return "unnamed";
         }
 
         @Override
-        public boolean isNamed() {
-            return false;
-        }
-
-        @Override
-        public boolean isAutomatic() {
-            return false;
-        }
-
-        @Override
         public boolean isExported(String pn) {
             return true;
         }
     }
 
< prev index next >