langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java
changeset 42827 36468b5fa7f4
parent 42822 a84956e7ee4d
equal deleted inserted replaced
42826:563b42fc70ba 42827:36468b5fa7f4
   246     public Set<Dependency> findAllDependencies(
   246     public Set<Dependency> findAllDependencies(
   247             ClassFileReader classFinder, Set<String> rootClassNames,
   247             ClassFileReader classFinder, Set<String> rootClassNames,
   248             boolean transitiveClosure)
   248             boolean transitiveClosure)
   249             throws ClassFileNotFoundException {
   249             throws ClassFileNotFoundException {
   250         final Set<Dependency> results = new HashSet<>();
   250         final Set<Dependency> results = new HashSet<>();
   251         Recorder r = new Recorder() {
   251         Recorder r = results::add;
   252             public void addDependency(Dependency d) {
       
   253                 results.add(d);
       
   254             }
       
   255         };
       
   256         findAllDependencies(classFinder, rootClassNames, transitiveClosure, r);
   252         findAllDependencies(classFinder, rootClassNames, transitiveClosure, r);
   257         return results;
   253         return results;
   258     }
   254     }
   259 
   255 
   260     /**
   256     /**
   563 
   559 
   564     static abstract class BasicDependencyFinder implements Finder {
   560     static abstract class BasicDependencyFinder implements Finder {
   565         private Map<String,Location> locations = new ConcurrentHashMap<>();
   561         private Map<String,Location> locations = new ConcurrentHashMap<>();
   566 
   562 
   567         Location getLocation(String className) {
   563         Location getLocation(String className) {
   568             return locations.computeIfAbsent(className, cn -> new SimpleLocation(cn));
   564             return locations.computeIfAbsent(className, SimpleLocation::new);
   569         }
   565         }
   570 
   566 
   571         class Visitor implements ConstantPool.Visitor<Void,Void>, Type.Visitor<Void, Void> {
   567         class Visitor implements ConstantPool.Visitor<Void,Void>, Type.Visitor<Void, Void> {
   572             private ConstantPool constant_pool;
   568             private ConstantPool constant_pool;
   573             private Location origin;
   569             private Location origin;