langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java
changeset 43873 705d732d3715
parent 43767 9cff98a149cb
equal deleted inserted replaced
43872:b5ce3bc28931 43873:705d732d3715
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   205                 ALL_DEFAULT.equals(name) ||
   205                 ALL_DEFAULT.equals(name) ||
   206                 ALL_SYSTEM.equals(name);
   206                 ALL_SYSTEM.equals(name);
   207     }
   207     }
   208 
   208 
   209     /**
   209     /**
   210      * Returns the modules that the given module can read
       
   211      */
       
   212     public Stream<Module> reads(Module module) {
       
   213         return configuration.findModule(module.name()).get()
       
   214             .reads().stream()
       
   215             .map(ResolvedModule::name)
       
   216             .map(nameToModule::get);
       
   217     }
       
   218 
       
   219     /**
       
   220      * Returns the list of packages that split between resolved module and
   210      * Returns the list of packages that split between resolved module and
   221      * unnamed module
   211      * unnamed module
   222      */
   212      */
   223     public Map<String, Set<String>> splitPackages() {
   213     public Map<String, Set<String>> splitPackages() {
   224         Set<String> splitPkgs = packageToModule.keySet().stream()
   214         Set<String> splitPkgs = packageToModule.keySet().stream()
   265      */
   255      */
   266     public Map<String, Module> getModules() {
   256     public Map<String, Module> getModules() {
   267         return nameToModule;
   257         return nameToModule;
   268     }
   258     }
   269 
   259 
   270     public Stream<Module> resolve(Set<String> roots) {
   260     /**
   271         if (roots.isEmpty()) {
   261      * Returns Configuration with the given roots
   272             return nameToModule.values().stream();
   262      */
   273         } else {
   263     public Configuration resolve(Set<String> roots) {
   274             return Configuration.empty()
   264         if (roots.isEmpty())
   275                     .resolve(finder, ModuleFinder.of(), roots)
   265             throw new IllegalArgumentException("empty roots");
   276                     .modules().stream()
   266 
   277                     .map(ResolvedModule::name)
   267         return Configuration.empty()
   278                     .map(nameToModule::get);
   268                     .resolve(finder, ModuleFinder.of(), roots);
   279         }
       
   280     }
   269     }
   281 
   270 
   282     public List<Archive> classPathArchives() {
   271     public List<Archive> classPathArchives() {
   283         return classpathArchives;
   272         return classpathArchives;
   284     }
   273     }