< prev index next >

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

Print this page
rev 50632 : [mq]: defaultroots

*** 1,7 **** /* ! * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 60,69 **** --- 60,70 ---- import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.function.Function; import java.util.function.Supplier; + import java.util.stream.Collectors; import java.util.stream.Stream; public class JdepsConfiguration implements AutoCloseable { // the token for "all modules on the module path" public static final String ALL_MODULE_PATH = "ALL-MODULE-PATH";
*** 317,327 **** module.close(); } static class SystemModuleFinder implements ModuleFinder { private static final String JAVA_HOME = System.getProperty("java.home"); - private static final String JAVA_SE = "java.se"; private final FileSystem fileSystem; private final Path root; private final Map<String, ModuleReference> systemModules; --- 318,327 ----
*** 442,474 **** throw new FileNotFoundException(mp.toString()); } } public Set<String> defaultSystemRoots() { ! Set<String> roots = new HashSet<>(); ! boolean hasJava = false; ! if (systemModules.containsKey(JAVA_SE)) { ! // java.se is a system module ! hasJava = true; ! roots.add(JAVA_SE); ! } ! ! for (ModuleReference mref : systemModules.values()) { ! String mn = mref.descriptor().name(); ! if (hasJava && mn.startsWith("java.")) ! continue; ! ! // add as root if observable and exports at least one package ! ModuleDescriptor descriptor = mref.descriptor(); ! for (ModuleDescriptor.Exports e : descriptor.exports()) { ! if (!e.isQualified()) { ! roots.add(mn); ! break; ! } ! } ! } ! return roots; } } public static class Builder { --- 442,460 ---- throw new FileNotFoundException(mp.toString()); } } public Set<String> defaultSystemRoots() { ! return systemModules.values().stream() ! .map(ModuleReference::descriptor) ! .filter(descriptor -> descriptor.exports() ! .stream() ! .filter(e -> !e.isQualified()) ! .findAny() ! .isPresent()) ! .map(ModuleDescriptor::name) ! .collect(Collectors.toSet()); } } public static class Builder {
< prev index next >