make/tools/classanalyzer/src/com/sun/classanalyzer/ModuleConfig.java

Print this page

        

@@ -52,17 +52,22 @@
     protected final Set<String> exports;
     private final Filter filter;
     private List<String> members;
     private String mainClass;
     final String module;
+    final String version;
 
-    ModuleConfig(String name) throws IOException {
-        this(name, null);
+    ModuleConfig(String name, String version) {
+        this(name, version, null);
     }
 
-    ModuleConfig(String name, String mainClass) throws IOException {
+    ModuleConfig(String name, String version, String mainClass)
+    {
+        assert name != null && version != null;
+        
         this.module = name;
+        this.version = version;
         this.roots = new TreeSet<String>();
         this.includes = new TreeSet<String>();
         this.permits = new TreeSet<String>();
         this.exports = new TreeSet<String>();
         this.requires = new LinkedHashMap<String, Dependence>();

@@ -73,12 +78,12 @@
     List<String> members() {
         if (members == null) {
             members = new LinkedList<String>();
 
             for (String s : includes) {
-                if (!s.contains("*") && Module.findModule(s) != null) {
-                    // module member
+                if (!s.contains("*")) {
+                    // this isn't necessarily a module.  Will determine later.
                     members.add(s);
                 }
             }
         }
         return members;

@@ -424,11 +429,11 @@
     }
     // TODO: we shall remove "-" from the regex once we define
     // the naming convention for the module names without dashes
     static final Pattern classNamePattern = Pattern.compile("[\\w\\.\\*_$-/]+");
 
-    static List<ModuleConfig> readConfigurationFile(String file) throws IOException {
+    static List<ModuleConfig> readConfigurationFile(String file, String version) throws IOException {
         List<ModuleConfig> result = new ArrayList<ModuleConfig>();
         // parse configuration file
         FileInputStream in = new FileInputStream(file);
         try {
             BufferedReader reader = new BufferedReader(new InputStreamReader(in));

@@ -481,11 +486,12 @@
                     if (keyword.equals("module")) {
                         if (s.length != 3 || !s[2].trim().equals("{")) {
                             throw new RuntimeException(file + ", line " +
                                     lineNumber + ", is malformed");
                         }
-                        config = new ModuleConfig(s[1].trim());
+                        // use the given version
+                        config = new ModuleConfig(s[1].trim(), version);
                         result.add(config);
                         // switch to a new module; so reset the flags
                         inRoots = false;
                         inIncludes = false;
                         inExcludes = false;