Path: blob/master/src/java.base/share/classes/jdk/internal/access/JavaLangModuleAccess.java
41159 views
/*1* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package jdk.internal.access;2627import java.io.PrintStream;28import java.lang.module.Configuration;29import java.lang.module.ModuleDescriptor;30import java.lang.module.ModuleDescriptor.Exports;31import java.lang.module.ModuleDescriptor.Opens;32import java.lang.module.ModuleDescriptor.Requires;33import java.lang.module.ModuleDescriptor.Provides;34import java.lang.module.ModuleDescriptor.Version;35import java.lang.module.ModuleFinder;36import java.util.Collection;37import java.util.List;38import java.util.Map;39import java.util.Set;4041/**42* Provides access to non-public methods in java.lang.module.43*/4445public interface JavaLangModuleAccess {4647/**48* Creates a builder for building a module with the given module name.49*50* @param strict51* Indicates whether module names are checked or not52*/53ModuleDescriptor.Builder newModuleBuilder(String mn,54boolean strict,55Set<ModuleDescriptor.Modifier> ms);5657/**58* Returns a snapshot of the packages in the module.59*/60Set<String> packages(ModuleDescriptor.Builder builder);6162/**63* Adds a dependence on a module with the given (possibly un-parsable)64* version string.65*/66void requires(ModuleDescriptor.Builder builder,67Set<Requires.Modifier> ms,68String mn,69String rawCompiledVersion);7071/**72* Returns a {@code ModuleDescriptor.Requires} of the given modifiers73* and module name.74*/75Requires newRequires(Set<Requires.Modifier> ms, String mn, Version v);7677/**78* Returns an unqualified {@code ModuleDescriptor.Exports}79* of the given modifiers and package name source.80*/81Exports newExports(Set<Exports.Modifier> ms,82String source);8384/**85* Returns a qualified {@code ModuleDescriptor.Exports}86* of the given modifiers, package name source and targets.87*/88Exports newExports(Set<Exports.Modifier> ms,89String source,90Set<String> targets);9192/**93* Returns an unqualified {@code ModuleDescriptor.Opens}94* of the given modifiers and package name source.95*/96Opens newOpens(Set<Opens.Modifier> ms, String source);9798/**99* Returns a qualified {@code ModuleDescriptor.Opens}100* of the given modifiers, package name source and targets.101*/102Opens newOpens(Set<Opens.Modifier> ms, String source, Set<String> targets);103104/**105* Returns a {@code ModuleDescriptor.Provides}106* of the given service name and providers.107*/108Provides newProvides(String service, List<String> providers);109110/**111* Returns a new {@code ModuleDescriptor} instance.112*/113ModuleDescriptor newModuleDescriptor(String name,114Version version,115Set<ModuleDescriptor.Modifier> ms,116Set<Requires> requires,117Set<Exports> exports,118Set<Opens> opens,119Set<String> uses,120Set<Provides> provides,121Set<String> packages,122String mainClass,123int hashCode);124125/**126* Resolves a collection of root modules, with service binding127* and the empty configuration as the parent.128*/129Configuration resolveAndBind(ModuleFinder finder,130Collection<String> roots,131PrintStream traceOutput);132133/**134* Creates a configuration from a pre-generated readability graph.135*/136Configuration newConfiguration(ModuleFinder finder,137Map<String, Set<String>> graph);138139}140141142