src/share/classes/com/sun/tools/jdeps/Archive.java

Print this page

        

@@ -23,35 +23,34 @@
  * questions.
  */
 package com.sun.tools.jdeps;
 
 import com.sun.tools.classfile.Dependency.Location;
-import java.io.File;
+import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
 /**
  * Represents the source of the class files.
  */
 public class Archive {
-    private final File file;
+    private final Path path;
     private final String filename;
     private final ClassFileReader reader;
-    private final Map<Location, Set<Location>> deps
-        = new HashMap<Location, Set<Location>>();
+    private final Map<Location, Set<Location>> deps = new HashMap<>();
 
     public Archive(String name) {
-        this.file = null;
+        this.path = null;
         this.filename = name;
         this.reader = null;
     }
 
-    public Archive(File f, ClassFileReader reader) {
-        this.file = f;
-        this.filename = f.getName();
+    public Archive(Path p, ClassFileReader reader) {
+        this.path = p;
+        this.filename = path.getFileName().toString();
         this.reader = reader;
     }
 
     public ClassFileReader reader() {
         return reader;

@@ -62,18 +61,18 @@
     }
 
     public void addClass(Location origin) {
         Set<Location> set = deps.get(origin);
         if (set == null) {
-            set = new HashSet<Location>();
+            set = new HashSet<>();
             deps.put(origin, set);
         }
     }
     public void addClass(Location origin, Location target) {
         Set<Location> set = deps.get(origin);
         if (set == null) {
-            set = new HashSet<Location>();
+            set = new HashSet<>();
             deps.put(origin, set);
         }
         set.add(target);
     }
 

@@ -85,11 +84,11 @@
             }
         }
     }
 
     public String toString() {
-        return file != null ? file.getPath() : filename;
+        return path != null ? path.toString() : filename;
     }
 
     interface Visitor {
         void visit(Location loc);
         void visit(Location origin, Location target);