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

changeset 2139
defadd528513
parent 1577
88286a36bb34
child 2172
aa91bc6e8480
     1.1 --- a/src/share/classes/com/sun/tools/jdeps/Archive.java	Thu Oct 17 13:50:00 2013 +0200
     1.2 +++ b/src/share/classes/com/sun/tools/jdeps/Archive.java	Thu Oct 17 13:19:48 2013 -0700
     1.3 @@ -25,7 +25,7 @@
     1.4  package com.sun.tools.jdeps;
     1.5  
     1.6  import com.sun.tools.classfile.Dependency.Location;
     1.7 -import java.io.File;
     1.8 +import java.nio.file.Path;
     1.9  import java.util.HashMap;
    1.10  import java.util.HashSet;
    1.11  import java.util.Map;
    1.12 @@ -35,21 +35,20 @@
    1.13   * Represents the source of the class files.
    1.14   */
    1.15  public class Archive {
    1.16 -    private final File file;
    1.17 +    private final Path path;
    1.18      private final String filename;
    1.19      private final ClassFileReader reader;
    1.20 -    private final Map<Location, Set<Location>> deps
    1.21 -        = new HashMap<Location, Set<Location>>();
    1.22 +    private final Map<Location, Set<Location>> deps = new HashMap<>();
    1.23  
    1.24      public Archive(String name) {
    1.25 -        this.file = null;
    1.26 +        this.path = null;
    1.27          this.filename = name;
    1.28          this.reader = null;
    1.29      }
    1.30  
    1.31 -    public Archive(File f, ClassFileReader reader) {
    1.32 -        this.file = f;
    1.33 -        this.filename = f.getName();
    1.34 +    public Archive(Path p, ClassFileReader reader) {
    1.35 +        this.path = p;
    1.36 +        this.filename = path.getFileName().toString();
    1.37          this.reader = reader;
    1.38      }
    1.39  
    1.40 @@ -64,14 +63,14 @@
    1.41      public void addClass(Location origin) {
    1.42          Set<Location> set = deps.get(origin);
    1.43          if (set == null) {
    1.44 -            set = new HashSet<Location>();
    1.45 +            set = new HashSet<>();
    1.46              deps.put(origin, set);
    1.47          }
    1.48      }
    1.49      public void addClass(Location origin, Location target) {
    1.50          Set<Location> set = deps.get(origin);
    1.51          if (set == null) {
    1.52 -            set = new HashSet<Location>();
    1.53 +            set = new HashSet<>();
    1.54              deps.put(origin, set);
    1.55          }
    1.56          set.add(target);
    1.57 @@ -87,7 +86,7 @@
    1.58      }
    1.59  
    1.60      public String toString() {
    1.61 -        return file != null ? file.getPath() : filename;
    1.62 +        return path != null ? path.toString() : filename;
    1.63      }
    1.64  
    1.65      interface Visitor {

mercurial