mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
8015912: jdeps support to output in dot file format
8026255: Switch jdeps to follow traditional Java option style Reviewed-by: alanb
This commit is contained in:
parent
c57660ca19
commit
1285dee32b
21 changed files with 1176 additions and 521 deletions
|
@ -25,7 +25,7 @@
|
|||
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;
|
||||
|
@ -35,21 +35,20 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -64,14 +63,14 @@ public class Archive {
|
|||
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);
|
||||
|
@ -87,7 +86,7 @@ public class Archive {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return file != null ? file.getPath() : filename;
|
||||
return path != null ? path.toString() : filename;
|
||||
}
|
||||
|
||||
interface Visitor {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue