< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/jdeps/InverseDepsAnalyzer.java

Print this page




 123      * use the archives depending the packages specified in -regex or -p options.
 124      */
 125     public Set<Deque<Archive>> inverseDependences() throws IOException {
 126         // create a new dependency finder to do the analysis
 127         DependencyFinder dependencyFinder = new DependencyFinder(configuration, DEFAULT_FILTER);
 128         try {
 129             // parse all archives in unnamed module to get compile-time dependences
 130             Stream<Archive> archives =
 131                 Stream.concat(configuration.initialArchives().stream(),
 132                               configuration.classPathArchives().stream());
 133             if (apiOnly) {
 134                 dependencyFinder.parseExportedAPIs(archives);
 135             } else {
 136                 dependencyFinder.parse(archives);
 137             }
 138 
 139             Graph.Builder<Archive> builder = new Graph.Builder<>();
 140             // include all target nodes
 141             targets().forEach(builder::addNode);
 142 
 143             // transpose the module graph - may filter JDK module
 144             configuration.getModules().values().stream()
 145                 .filter(filter::include)
 146                 .forEach(m -> {
 147                     builder.addNode(m);
 148                     m.descriptor().requires().stream()
 149                         .map(Requires::name)
 150                         .map(configuration::findModule)  // must be present
 151                         .forEach(v -> builder.addEdge(v.get(), m));
 152                 });
 153 
 154             // add the dependences from the analysis
 155             Map<Archive, Set<Archive>> dependences = dependencyFinder.dependences();
 156             dependences.entrySet().stream()
 157                 .forEach(e -> {
 158                     Archive u = e.getKey();
 159                     builder.addNode(u);
 160                     e.getValue().forEach(v -> builder.addEdge(v, u));
 161                 });
 162 
 163             // transposed dependence graph.
 164             Graph<Archive> graph = builder.build();
 165             trace("targets: %s%n", targets());




 123      * use the archives depending the packages specified in -regex or -p options.
 124      */
 125     public Set<Deque<Archive>> inverseDependences() throws IOException {
 126         // create a new dependency finder to do the analysis
 127         DependencyFinder dependencyFinder = new DependencyFinder(configuration, DEFAULT_FILTER);
 128         try {
 129             // parse all archives in unnamed module to get compile-time dependences
 130             Stream<Archive> archives =
 131                 Stream.concat(configuration.initialArchives().stream(),
 132                               configuration.classPathArchives().stream());
 133             if (apiOnly) {
 134                 dependencyFinder.parseExportedAPIs(archives);
 135             } else {
 136                 dependencyFinder.parse(archives);
 137             }
 138 
 139             Graph.Builder<Archive> builder = new Graph.Builder<>();
 140             // include all target nodes
 141             targets().forEach(builder::addNode);
 142 
 143             // transpose the module graph
 144             configuration.getModules().values().stream()

 145                 .forEach(m -> {
 146                     builder.addNode(m);
 147                     m.descriptor().requires().stream()
 148                         .map(Requires::name)
 149                         .map(configuration::findModule)  // must be present
 150                         .forEach(v -> builder.addEdge(v.get(), m));
 151                 });
 152 
 153             // add the dependences from the analysis
 154             Map<Archive, Set<Archive>> dependences = dependencyFinder.dependences();
 155             dependences.entrySet().stream()
 156                 .forEach(e -> {
 157                     Archive u = e.getKey();
 158                     builder.addNode(u);
 159                     e.getValue().forEach(v -> builder.addEdge(v, u));
 160                 });
 161 
 162             // transposed dependence graph.
 163             Graph<Archive> graph = builder.build();
 164             trace("targets: %s%n", targets());


< prev index next >