This commit is contained in:
Lana Steuck 2017-05-11 23:21:42 +00:00
commit 331e956b48
349 changed files with 6925 additions and 2901 deletions

View File

@ -418,3 +418,4 @@ d1436b2945383cef15edbdba9bb41ef1656c987b jdk-10+5
329609d00aef2443cf1e44ded94637c5ed55a143 jdk-10+6
7828aedcb525df40b7c8122bcc3f997c75ebaf7f jdk-9+167
e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168
177436a54ca13730ffc725a6e5dbfcd9486f3da3 jdk-9+169

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 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
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
body {
margin: 2em 2em;
font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica;
font-size: 10pt;
line-height: 1.4;
}
pre, code, tt {
font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Luxi Mono,
Courier New, monospace;
}
blockquote {
margin: 1.5ex 0em 1.5ex 2em;
}
p {
padding: 0pt;
margin: 1ex 0em;
}
p:first-child, pre:first-child { margin-top: 0pt; }
h1 {
font-weight: bold;
padding: 0pt;
margin: 2ex .5ex 1ex 0pt;
}
h1:first-child, h2:first-child {
margin-top: 0ex;
}
h2 {
font-weight: bold;
padding: 0pt;
margin: 2ex 0pt 1ex 0pt;
}
h3 {
font-weight: bold;
padding: 0pt;
margin: 1.5ex 0pt 1ex 0pt;
}
h4 {
font-weight: bold;
padding: 0pt;
margin: 1.5ex 0pt 1ex 0pt;
}
a:link {
color: #437291;
}
a:visited {
color: #666666;
}
a[href]:hover {
color: #e76f00;
}
a img {
border-width: 0px;
}
img {
background: white;
}
table {
border-collapse: collapse;
margin-left: 15px;
margin-right: 15px;
}
th, td {
padding: 3px;
vertical-align: top;
}
table, th, td {
border: 1px solid black;
}
caption {
text-align: left;
font-style: italic;
text-indent: 15px;
margin-bottom:10px;
}
tr:nth-child(even) {
background: #DDD;
}
tr:nth-child(odd) {
background: #FFF;
}
th {
background: #DDF;
}

View File

@ -39,6 +39,7 @@ SUNWprivate_1.1 {
Java_sun_instrument_InstrumentationImpl_getObjectSize0;
Java_sun_instrument_InstrumentationImpl_appendToClassLoaderSearch0;
Java_sun_instrument_InstrumentationImpl_setNativeMethodPrefixes;
Java_sun_instrument_InstrumentationImpl_loadAgent0;
local:
*;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 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

View File

@ -29,6 +29,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
@ -62,12 +64,17 @@ final class PropMap implements SortedMap<String, String> {
Properties props = new Properties();
// Allow implementation selected via -Dpack.disable.native=true
String propValue = getPropertyValue(Utils.DEBUG_DISABLE_NATIVE, "false");
props.put(Utils.DEBUG_DISABLE_NATIVE,
String.valueOf(Boolean.getBoolean(Utils.DEBUG_DISABLE_NATIVE)));
String.valueOf(Boolean.parseBoolean(propValue)));
// Set the DEBUG_VERBOSE from system
props.put(Utils.DEBUG_VERBOSE,
String.valueOf(Integer.getInteger(Utils.DEBUG_VERBOSE,0)));
int verbose = 0;
try {
verbose = Integer.decode(getPropertyValue(Utils.DEBUG_VERBOSE, "0"));
} catch (NumberFormatException e) {
}
props.put(Utils.DEBUG_VERBOSE, String.valueOf(verbose));
// The segment size is unlimited
props.put(Pack200.Packer.SEGMENT_LIMIT, "-1");
@ -87,7 +94,7 @@ final class PropMap implements SortedMap<String, String> {
// Pass through files with unrecognized format by default, also
// allow system property to be set
props.put(Utils.CLASS_FORMAT_ERROR,
System.getProperty(Utils.CLASS_FORMAT_ERROR, Pack200.Packer.PASS));
getPropertyValue(Utils.CLASS_FORMAT_ERROR, Pack200.Packer.PASS));
// Default effort is 5, midway between 1 and 9.
props.put(Pack200.Packer.EFFORT, "5");
@ -97,7 +104,9 @@ final class PropMap implements SortedMap<String, String> {
// to allow override if necessary.
String propFile = "intrinsic.properties";
try (InputStream propStr = PackerImpl.class.getResourceAsStream(propFile)) {
PrivilegedAction<InputStream> pa =
() -> PackerImpl.class.getResourceAsStream(propFile);
try (InputStream propStr = AccessController.doPrivileged(pa)) {
if (propStr == null) {
throw new RuntimeException(propFile + " cannot be loaded");
}
@ -119,6 +128,12 @@ final class PropMap implements SortedMap<String, String> {
defaultProps = temp;
}
private static String getPropertyValue(String key, String defaultValue) {
PrivilegedAction<String> pa = () -> System.getProperty(key);
String s = AccessController.doPrivileged(pa);
return s != null ? s : defaultValue;
}
PropMap() {
theMap.putAll(defaultProps);
}

View File

@ -40,10 +40,8 @@ import sun.nio.cs.StreamEncoder;
*
* <p> Each invocation of a write() method causes the encoding converter to be
* invoked on the given character(s). The resulting bytes are accumulated in a
* buffer before being written to the underlying output stream. The size of
* this buffer may be specified, but by default it is large enough for most
* purposes. Note that the characters passed to the write() methods are not
* buffered.
* buffer before being written to the underlying output stream. Note that the
* characters passed to the write() methods are not buffered.
*
* <p> For top efficiency, consider wrapping an OutputStreamWriter within a
* BufferedWriter so as to avoid frequent converter invocations. For example:

View File

@ -119,18 +119,24 @@ import sun.security.util.SecurityConstants;
* The Java run-time has the following built-in class loaders:
*
* <ul>
* <li>Bootstrap class loader.
* <li><p>Bootstrap class loader.
* It is the virtual machine's built-in class loader, typically represented
* as {@code null}, and does not have a parent.</li>
* <li>{@linkplain #getPlatformClassLoader() Platform class loader}.
* <li><p>{@linkplain #getPlatformClassLoader() Platform class loader}.
* All <em>platform classes</em> are visible to the platform class loader
* that can be used as the parent of a {@code ClassLoader} instance.
* Platform classes include Java SE platform APIs, their implementation
* classes and JDK-specific run-time classes that are defined by the
* platform class loader or its ancestors.</li>
* <li>{@linkplain #getSystemClassLoader() System class loader}.
* It is also known as <em>application class
* loader</em> and is distinct from the platform class loader.
* platform class loader or its ancestors.
* <p> To allow for upgrading/overriding of modules defined to the platform
* class loader, and where classes in the upgraded version link to
* classes in modules defined to the application class loader, the
* platform class loader may delegate to the application class loader.
* In other words, classes in named modules defined to the application
* class loader may be visible to the platform class loader. </li>
* <li><p>{@linkplain #getSystemClassLoader() System class loader}.
* It is also known as <em>application class loader</em> and is distinct
* from the platform class loader.
* The system class loader is typically used to define classes on the
* application class path, module path, and JDK-specific tools.
* The platform class loader is a parent or an ancestor of the system class
@ -368,6 +374,10 @@ public abstract class ClassLoader {
* Creates a new class loader of the specified name and using the
* specified parent class loader for delegation.
*
* @apiNote If the parent is specified as {@code null} (for the
* bootstrap class loader) then there is no guarantee that all platform
* classes are visible.
*
* @param name class loader name; or {@code null} if not named
* @param parent the parent class loader
*
@ -390,9 +400,12 @@ public abstract class ClassLoader {
* delegation.
*
* <p> If there is a security manager, its {@link
* SecurityManager#checkCreateClassLoader()
* checkCreateClassLoader} method is invoked. This may result in
* a security exception. </p>
* SecurityManager#checkCreateClassLoader() checkCreateClassLoader} method
* is invoked. This may result in a security exception. </p>
*
* @apiNote If the parent is specified as {@code null} (for the
* bootstrap class loader) then there is no guarantee that all platform
* classes are visible.
*
* @param parent
* The parent class loader
@ -2206,6 +2219,12 @@ public abstract class ClassLoader {
* this class loader are searched recursively (parent by parent)
* for a {@code Package} of the given name.
*
* @apiNote The {@link #getPlatformClassLoader() platform class loader}
* may delegate to the application class loader but the application class
* loader is not its ancestor. When invoked on the platform class loader,
* this method will not find packages defined to the application
* class loader.
*
* @param name
* The <a href="#name">package name</a>
*
@ -2251,6 +2270,14 @@ public abstract class ClassLoader {
* {@code Package} object of the same package name, each defined by
* a different class loader in the class loader hierarchy.
*
* @apiNote The {@link #getPlatformClassLoader() platform class loader}
* may delegate to the application class loader. In other words,
* packages in modules defined to the application class loader may be
* visible to the platform class loader. On the other hand,
* the application class loader is not its ancestor and hence
* when invoked on the platform class loader, this method will not
* return any packages defined to the application class loader.
*
* @return The array of {@code Package} objects defined by this
* class loader and its ancestors
*

View File

@ -57,6 +57,7 @@ import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.loader.BootLoader;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.module.ModuleLoaderMap;
import jdk.internal.module.ServicesCatalog;
import jdk.internal.module.Resources;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@ -215,8 +216,8 @@ public final class Module implements AnnotatedElement {
}
/**
* Returns the layer that contains this module or {@code null} if this
* module is not in a layer.
* Returns the module layer that contains this module or {@code null} if
* this module is not in a module layer.
*
* A module layer contains named modules and therefore this method always
* returns {@code null} when invoked on an unnamed module.
@ -691,6 +692,13 @@ public final class Module implements AnnotatedElement {
* <p> This method has no effect if the package is already <em>open</em>
* to the given module. </p>
*
* @apiNote This method can be used for cases where a <em>consumer
* module</em> uses a qualified opens to open a package to an <em>API
* module</em> but where the reflective access to the members of classes in
* the consumer module is delegated to code in another module. Code in the
* API module can use this method to open the package in the consumer module
* to the other module.
*
* @param pn
* The package name
* @param other
@ -1077,7 +1085,7 @@ public final class Module implements AnnotatedElement {
if (loader != null) {
moduleToLoader.put(name, loader);
loaders.add(loader);
} else if (!isBootLayer) {
} else if (!(clf instanceof ModuleLoaderMap.Mapper)) {
throw new IllegalArgumentException("loader can't be 'null'");
}
}
@ -1458,11 +1466,11 @@ public final class Module implements AnnotatedElement {
* encapsulated. </li>
*
* <li> A <em>package name</em> is derived from the resource name. If
* the package name is a {@link #getPackages() package} in the module
* then the resource can only be located by the caller of this method
* when the package is {@link #isOpen(String,Module) open} to at least
* the caller's module. If the resource is not in a package in the module
* then the resource is not encapsulated. </li>
* the package name is a {@linkplain #getPackages() package} in the
* module then the resource can only be located by the caller of this
* method when the package is {@linkplain #isOpen(String,Module) open}
* to at least the caller's module. If the resource is not in a
* package in the module then the resource is not encapsulated. </li>
* </ul>
*
* <p> In the above, the <em>package name</em> for a resource is derived
@ -1521,8 +1529,7 @@ public final class Module implements AnnotatedElement {
}
// locate resource in module
JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
URL url = jla.findResource(loader, mn, name);
URL url = loader.findResource(mn, name);
if (url != null) {
try {
return url.openStream();

View File

@ -25,10 +25,10 @@
package java.lang;
import java.lang.RuntimePermission;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Exports;
import java.lang.module.ModuleDescriptor.Opens;
import java.lang.module.ModuleReference;
import java.lang.reflect.Member;
import java.io.FileDescriptor;
import java.io.File;
@ -42,12 +42,15 @@ import java.security.PrivilegedAction;
import java.security.Security;
import java.security.SecurityPermission;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.PropertyPermission;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jdk.internal.module.ModuleBootstrap;
import jdk.internal.module.ModuleLoaderMap;
import jdk.internal.reflect.CallerSensitive;
import sun.security.util.SecurityConstants;
@ -1431,30 +1434,30 @@ class SecurityManager {
return packages;
}
// The non-exported packages of the modules in the boot layer that are
// loaded by the platform class loader or its ancestors. A non-exported
// package is a package that either is not exported at all by its containing
// module or is exported in a qualified fashion by its containing module.
private static final Set<String> nonExportedPkgs;
// The non-exported packages in modules defined to the boot or platform
// class loaders. A non-exported package is a package that is not exported
// or is only exported to specific modules.
private static final Map<String, Boolean> nonExportedPkgs = new ConcurrentHashMap<>();
static {
// Get the modules in the boot layer
Stream<Module> bootLayerModules = ModuleLayer.boot().modules().stream();
// Filter out the modules loaded by the boot or platform loader
PrivilegedAction<Set<Module>> pa = () ->
bootLayerModules.filter(SecurityManager::isBootOrPlatformModule)
.collect(Collectors.toSet());
Set<Module> modules = AccessController.doPrivileged(pa);
// Filter out the non-exported packages
nonExportedPkgs = modules.stream()
.map(Module::getDescriptor)
.map(SecurityManager::nonExportedPkgs)
.flatMap(Set::stream)
.collect(Collectors.toSet());
addNonExportedPackages(ModuleLayer.boot());
}
/**
* Record the non-exported packages of the modules in the given layer
*/
static void addNonExportedPackages(ModuleLayer layer) {
Set<String> bootModules = ModuleLoaderMap.bootModules();
Set<String> platformModules = ModuleLoaderMap.platformModules();
layer.modules().stream()
.map(Module::getDescriptor)
.filter(md -> bootModules.contains(md.name())
|| platformModules.contains(md.name()))
.map(SecurityManager::nonExportedPkgs)
.flatMap(Set::stream)
.forEach(pn -> nonExportedPkgs.put(pn, Boolean.TRUE));
}
/**
* Called by java.security.Security
*/
@ -1467,14 +1470,6 @@ class SecurityManager {
}
}
/**
* Returns true if the module's loader is the boot or platform loader.
*/
private static boolean isBootOrPlatformModule(Module m) {
return m.getClassLoader() == null ||
m.getClassLoader() == ClassLoader.getPlatformClassLoader();
}
/**
* Returns the non-exported packages of the specified module.
*/
@ -1535,7 +1530,7 @@ class SecurityManager {
Objects.requireNonNull(pkg, "package name can't be null");
// check if pkg is not exported to all modules
if (nonExportedPkgs.contains(pkg)) {
if (nonExportedPkgs.containsKey(pkg)) {
checkPermission(
new RuntimePermission("accessClassInPackage." + pkg));
return;
@ -1634,7 +1629,7 @@ class SecurityManager {
Objects.requireNonNull(pkg, "package name can't be null");
// check if pkg is not exported to all modules
if (nonExportedPkgs.contains(pkg)) {
if (nonExportedPkgs.containsKey(pkg)) {
checkPermission(
new RuntimePermission("defineClassInPackage." + pkg));
return;

View File

@ -41,7 +41,6 @@ import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URI;
import java.net.URL;
import java.security.AccessControlContext;
import java.security.ProtectionDomain;
import java.security.AccessController;
@ -2113,9 +2112,6 @@ public final class System {
public Class<?> findBootstrapClassOrNull(ClassLoader cl, String name) {
return cl.findBootstrapClassOrNull(name);
}
public URL findResource(ClassLoader cl, String mn, String name) throws IOException {
return cl.findResource(mn, name);
}
public Stream<Package> packages(ClassLoader cl) {
return cl.packages();
}
@ -2125,6 +2121,9 @@ public final class System {
public String fastUUID(long lsb, long msb) {
return Long.fastUUID(lsb, msb);
}
public void addNonExportedPackages(ModuleLayer layer) {
SecurityManager.addNonExportedPackages(layer);
}
public void invalidatePackageAccessCache() {
SecurityManager.invalidatePackageAccessCache();
}

View File

@ -112,6 +112,19 @@ public class MethodHandles {
return new Lookup(Reflection.getCallerClass());
}
/**
* This reflected$lookup method is the alternate implementation of
* the lookup method when being invoked by reflection.
*/
@CallerSensitive
private static Lookup reflected$lookup() {
Class<?> caller = Reflection.getCallerClass();
if (caller.getClassLoader() == null) {
throw newIllegalArgumentException("illegal lookupClass: "+caller);
}
return new Lookup(caller);
}
/**
* Returns a {@link Lookup lookup object} which is trusted minimally.
* The lookup has the {@code PUBLIC} and {@code UNCONDITIONAL} modes.
@ -747,7 +760,7 @@ public class MethodHandles {
Lookup(Class<?> lookupClass) {
this(lookupClass, FULL_POWER_MODES);
// make sure we haven't accidentally picked up a privileged class:
checkUnprivilegedlookupClass(lookupClass, FULL_POWER_MODES);
checkUnprivilegedlookupClass(lookupClass);
}
private Lookup(Class<?> lookupClass, int allowedModes) {
@ -827,7 +840,7 @@ public class MethodHandles {
newModes = 0;
}
checkUnprivilegedlookupClass(requestedLookupClass, newModes);
checkUnprivilegedlookupClass(requestedLookupClass);
return new Lookup(requestedLookupClass, newModes);
}
@ -876,9 +889,7 @@ public class MethodHandles {
* accessible to the class. The {@code PACKAGE} lookup mode serves to authenticate
* that the lookup object was created by a caller in the runtime package (or derived
* from a lookup originally created by suitably privileged code to a target class in
* the runtime package). The lookup modes cannot include {@link #PRIVATE PRIVATE}
* access. A lookup with {@code PRIVATE} access can be downgraded to drop this lookup
* mode with the {@linkplain #dropLookupMode(int) dropLookupMode} method. </p>
* the runtime package). </p>
*
* <p> The {@code bytes} parameter is the class bytes of a valid class file (as defined
* by the <em>The Java Virtual Machine Specification</em>) with a class name in the
@ -896,7 +907,6 @@ public class MethodHandles {
* @throws IllegalArgumentException the bytes are for a class in a different package
* to the lookup class
* @throws IllegalAccessException if this lookup does not have {@code PACKAGE} access
* @throws UnsupportedOperationException if the lookup class has {@code PRIVATE} access
* @throws LinkageError if the class is malformed ({@code ClassFormatError}), cannot be
* verified ({@code VerifyError}), is already defined, or another linkage error occurs
* @throws SecurityException if denied by the security manager
@ -911,8 +921,6 @@ public class MethodHandles {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new RuntimePermission("defineClass"));
if (hasPrivateAccess())
throw new UnsupportedOperationException("PRIVATE access not supported");
if ((lookupModes() & PACKAGE) == 0)
throw new IllegalAccessException("Lookup does not have PACKAGE access");
assert (lookupModes() & (MODULE|PUBLIC)) != 0;
@ -984,25 +992,10 @@ public class MethodHandles {
*/
static final Lookup PUBLIC_LOOKUP = new Lookup(Object.class, (PUBLIC|UNCONDITIONAL));
private static void checkUnprivilegedlookupClass(Class<?> lookupClass, int allowedModes) {
private static void checkUnprivilegedlookupClass(Class<?> lookupClass) {
String name = lookupClass.getName();
if (name.startsWith("java.lang.invoke."))
throw newIllegalArgumentException("illegal lookupClass: "+lookupClass);
// For caller-sensitive MethodHandles.lookup() disallow lookup from
// restricted packages. This a fragile and blunt approach.
// TODO replace with a more formal and less fragile mechanism
// that does not bluntly restrict classes under packages within
// java.base from looking up MethodHandles or VarHandles.
if (allowedModes == FULL_POWER_MODES && lookupClass.getClassLoader() == null) {
if ((name.startsWith("java.") &&
!name.equals("java.lang.Thread") &&
!name.startsWith("java.util.concurrent.")) ||
(name.startsWith("sun.") &&
!name.startsWith("sun.invoke."))) {
throw newIllegalArgumentException("illegal lookupClass: " + lookupClass);
}
}
}
/**

View File

@ -109,20 +109,17 @@ public final class Configuration {
private final Set<ResolvedModule> modules;
private final Map<String, ResolvedModule> nameToModule;
// module constraints on target
private final String osName;
private final String osArch;
// constraint on target platform
private final String targetPlatform;
String osName() { return osName; }
String osArch() { return osArch; }
String targetPlatform() { return targetPlatform; }
private Configuration() {
this.parents = Collections.emptyList();
this.graph = Collections.emptyMap();
this.modules = Collections.emptySet();
this.nameToModule = Collections.emptyMap();
this.osName = null;
this.osArch = null;
this.targetPlatform = null;
}
private Configuration(List<Configuration> parents,
@ -147,8 +144,7 @@ public final class Configuration {
this.modules = Set.of(moduleArray);
this.nameToModule = Map.ofEntries(nameEntries);
this.osName = resolver.osName();
this.osArch = resolver.osArch();
this.targetPlatform = resolver.targetPlatform();
}
/**

View File

@ -99,6 +99,7 @@ public class ModuleDescriptor
*
* @see ModuleDescriptor#modifiers()
* @since 9
* @spec JPMS
*/
public static enum Modifier {
/**

View File

@ -286,8 +286,9 @@ public interface ModuleFinder {
* class names of provider classes. </p></li>
*
* <li><p> If the JAR file has a {@code Main-Class} attribute in its
* main manifest then its value is the module {@link
* ModuleDescriptor#mainClass() main class}. </p></li>
* main manifest, its value is a legal class name, and its package is
* in the set of packages derived for the module, then the value is the
* module {@linkplain ModuleDescriptor#mainClass() main class}. </p></li>
*
* </ul>
*
@ -298,8 +299,7 @@ public interface ModuleFinder {
* file, where the JAR file contains a {@code .class} in the top-level
* directory of the JAR file, where an entry in a service configuration
* file is not a legal class name or its package name is not in the set of
* packages derived for the module, or where the module main class is not
* a legal class name or its package is not in the module. </p>
* packages derived for the module. </p>
*
* <p> In addition to JAR files, an implementation may also support modules
* that are packaged in other implementation specific module formats. If

View File

@ -28,6 +28,7 @@ package java.lang.module;
import java.io.PrintStream;
import java.lang.module.ModuleDescriptor.Provides;
import java.lang.module.ModuleDescriptor.Requires.Modifier;
import java.net.URI;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
@ -38,10 +39,8 @@ import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import jdk.internal.module.ModuleHashes;
@ -69,12 +68,10 @@ final class Resolver {
// true if all automatic modules have been found
private boolean haveAllAutomaticModules;
// module constraints on target platform
private String osName;
private String osArch;
// constraint on target platform
private String targetPlatform;
String osName() { return osName; }
String osArch() { return osArch; }
String targetPlatform() { return targetPlatform; }
/**
* @throws IllegalArgumentException if there are more than one parent and
@ -89,37 +86,23 @@ final class Resolver {
this.afterFinder = afterFinder;
this.traceOutput = traceOutput;
// record constraints on target platform, checking that they don't conflict
// record constraint on target platform, checking for conflicts
for (Configuration parent : parents) {
String value = parent.osName();
String value = parent.targetPlatform();
if (value != null) {
if (osName == null) {
osName = value;
if (targetPlatform == null) {
targetPlatform = value;
} else {
if (!value.equals(osName)) {
failParentConflict("Operating System", osName, value);
}
}
}
value = parent.osArch();
if (value != null) {
if (osArch == null) {
osArch = value;
} else {
if (!value.equals(osArch)) {
failParentConflict("OS architecture", osArch, value);
if (!value.equals(targetPlatform)) {
String msg = "Parents have conflicting constraints on target" +
" platform: " + targetPlatform + ", " + value;
throw new IllegalArgumentException(msg);
}
}
}
}
}
private void failParentConflict(String constraint, String s1, String s2) {
String msg = "Parents have conflicting constraints on target "
+ constraint + ": " + s1 + ", " + s2;
throw new IllegalArgumentException(msg);
}
/**
* Resolves the given named modules.
*
@ -147,8 +130,7 @@ final class Resolver {
}
if (isTracing()) {
trace("Root module %s located", root);
mref.location().ifPresent(uri -> trace(" (%s)", uri));
trace("root %s", nameAndInfo(mref));
}
addFoundModule(mref);
@ -180,9 +162,7 @@ final class Resolver {
ModuleDescriptor other = mref.descriptor();
q.offer(other);
if (isTracing()) {
trace("Automatic module %s located, required by %s",
other.name(), descriptor.name());
mref.location().ifPresent(uri -> trace(" (%s)", uri));
trace("%s requires %s", descriptor.name(), nameAndInfo(mref));
}
});
haveAllAutomaticModules = true;
@ -213,21 +193,13 @@ final class Resolver {
}
}
if (isTracing() && !dn.equals("java.base")) {
trace("%s requires %s", descriptor.name(), nameAndInfo(mref));
}
if (!nameToReference.containsKey(dn)) {
addFoundModule(mref);
q.offer(mref.descriptor());
if (isTracing()) {
String prefix;
if (mref.descriptor().isAutomatic()) {
prefix = "Automatic module";
} else {
prefix = "Module";
}
trace(prefix + " %s located, required by %s",
dn, descriptor.name());
mref.location().ifPresent(uri -> trace(" (%s)", uri));
}
}
}
@ -291,6 +263,13 @@ final class Resolver {
do {
for (ModuleDescriptor descriptor : candidateConsumers) {
if (!descriptor.uses().isEmpty()) {
// the modules that provide at least one service
Set<ModuleDescriptor> modulesToBind = null;
if (isTracing()) {
modulesToBind = new HashSet<>();
}
for (String service : descriptor.uses()) {
Set<ModuleReference> mrefs = availableProviders.get(service);
if (mrefs != null) {
@ -298,15 +277,13 @@ final class Resolver {
ModuleDescriptor provider = mref.descriptor();
if (!provider.equals(descriptor)) {
trace("Module %s provides %s, used by %s",
provider.name(), service, descriptor.name());
if (isTracing() && modulesToBind.add(provider)) {
trace("%s binds %s", descriptor.name(),
nameAndInfo(mref));
}
String pn = provider.name();
if (!nameToReference.containsKey(pn)) {
if (isTracing()) {
mref.location()
.ifPresent(uri -> trace(" (%s)", uri));
}
addFoundModule(mref);
q.push(provider);
}
@ -349,59 +326,31 @@ final class Resolver {
if (mref instanceof ModuleReferenceImpl) {
ModuleTarget target = ((ModuleReferenceImpl)mref).moduleTarget();
if (target != null)
checkTargetConstraints(mn, target);
checkTargetPlatform(mn, target);
}
nameToReference.put(mn, mref);
}
/**
* Check that the module's constraints on the target platform do not
* conflict with the constraints of other modules resolved so far or
* modules in parent configurations.
* Check that the module's constraints on the target platform does
* conflict with the constraint of other modules resolved so far.
*/
private void checkTargetConstraints(String mn, ModuleTarget target) {
String value = target.osName();
private void checkTargetPlatform(String mn, ModuleTarget target) {
String value = target.targetPlatform();
if (value != null) {
if (osName == null) {
osName = value;
if (targetPlatform == null) {
targetPlatform = value;
} else {
if (!value.equals(osName)) {
failTargetConstraint(mn, target);
}
}
}
value = target.osArch();
if (value != null) {
if (osArch == null) {
osArch = value;
} else {
if (!value.equals(osArch)) {
failTargetConstraint(mn, target);
if (!value.equals(targetPlatform)) {
findFail("Module %s has constraints on target platform (%s)"
+ " that conflict with other modules: %s", mn,
value, targetPlatform);
}
}
}
}
private void failTargetConstraint(String mn, ModuleTarget target) {
String s1 = targetAsString(osName, osArch);
String s2 = targetAsString(target.osName(), target.osArch());
findFail("Module %s has constraints on target platform (%s) that"
+ " conflict with other modules: %s", mn, s1, s2);
}
private String targetAsString(ModuleTarget target) {
return targetAsString(target.osName(), target.osArch());
}
private String targetAsString(String osName, String osArch) {
return new StringJoiner("-")
.add(Objects.toString(osName, "*"))
.add(Objects.toString(osArch, "*"))
.toString();
}
/**
* Execute post-resolution checks and returns the module graph of resolved
* modules as {@code Map}. The resolved modules will be in the given
@ -412,12 +361,6 @@ final class Resolver {
Map<ResolvedModule, Set<ResolvedModule>> finish(Configuration cf,
boolean check)
{
if (isTracing()) {
trace("Result:");
Set<String> names = nameToReference.keySet();
names.stream().sorted().forEach(name -> trace(" %s", name));
}
if (check) {
detectCycles();
checkHashes();
@ -520,9 +463,8 @@ final class Resolver {
findFail("Unable to compute the hash of module %s", dn);
}
// skip checking the hash if the module has been patched
ModuleReferenceImpl other = (ModuleReferenceImpl)mref2;
if (other != null && !other.isPatched()) {
if (other != null) {
byte[] recordedHash = hashes.hashFor(dn);
byte[] actualHash = other.computeHash(algorithm);
if (actualHash == null)
@ -965,9 +907,17 @@ final class Resolver {
private void trace(String fmt, Object ... args) {
if (traceOutput != null) {
traceOutput.format("[Resolver] " + fmt, args);
traceOutput.format(fmt, args);
traceOutput.println();
}
}
private String nameAndInfo(ModuleReference mref) {
ModuleDescriptor descriptor = mref.descriptor();
StringBuilder sb = new StringBuilder(descriptor.name());
mref.location().ifPresent(uri -> sb.append(" " + uri));
if (descriptor.isAutomatic())
sb.append(" automatic");
return sb.toString();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -36,6 +36,8 @@ import java.util.Map;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import jdk.internal.misc.VM;
/**
* Factory methods for file systems. This class defines the {@link #getDefault
* getDefault} method to get the default file system and factory methods to
@ -120,8 +122,8 @@ public final class FileSystems {
// if the property java.nio.file.spi.DefaultFileSystemProvider is
// set then its value is the name of the default provider (or a list)
String propValue = System
.getProperty("java.nio.file.spi.DefaultFileSystemProvider");
String prop = "java.nio.file.spi.DefaultFileSystemProvider";
String propValue = System.getProperty(prop);
if (propValue != null) {
for (String cn: propValue.split(",")) {
try {
@ -184,7 +186,7 @@ public final class FileSystems {
* @return the default file system
*/
public static FileSystem getDefault() {
if (jdk.internal.misc.VM.isBooted()) {
if (VM.isModuleSystemInited()) {
return DefaultFileSystemHolder.defaultFileSystem;
} else {
return BuiltinFileSystemHolder.builtinFileSystem;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -93,7 +93,7 @@ public class CipherInputStream extends FilterInputStream {
// stream status
private boolean closed = false;
/**
/*
* private convenience function.
*
* Entry condition: ostart = ofinish

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -196,19 +196,19 @@ class CryptoPermission extends java.security.Permission {
* Checks if the specified permission is "implied" by
* this object.
* <p>
* More specifically, this method returns true if:<p>
* More specifically, this method returns true if:
* <ul>
* <li> <i>p</i> is an instance of CryptoPermission, and<p>
* <li> <i>p</i> is an instance of CryptoPermission, and</li>
* <li> <i>p</i>'s algorithm name equals or (in the case of wildcards)
* is implied by this permission's algorithm name, and<p>
* is implied by this permission's algorithm name, and</li>
* <li> <i>p</i>'s maximum allowable key size is less or
* equal to this permission's maximum allowable key size, and<p>
* equal to this permission's maximum allowable key size, and</li>
* <li> <i>p</i>'s algorithm parameter spec equals or is
* implied by this permission's algorithm parameter spec, and<p>
* implied by this permission's algorithm parameter spec, and</li>
* <li> <i>p</i>'s exemptionMechanism equals or
* is implied by this permission's
* exemptionMechanism (a <code>null</code> exemption mechanism
* implies any other exemption mechanism).
* implies any other exemption mechanism).</li>
* </ul>
*
* @param p the permission to check against.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -46,10 +46,12 @@ import java.lang.reflect.*;
*
* The format of a permission entry in the jurisdiction policy file is:
*
* <pre>{@code
* permission <crypto permission class name>[, <algorithm name>
* [[, <exemption mechanism name>][, <maxKeySize>
* [, <AlgrithomParameterSpec class name>, <parameters
* for constructing an AlgrithomParameterSpec object>]]]];
* }</pre>
*
* @author Sharon Liu
*
@ -526,8 +528,7 @@ final class CryptoPolicyParser {
/**
* Each grant entry in the policy configuration file is represented by a
* GrantEntry object. <p>
*
* GrantEntry object.
* <p>
* For example, the entry
* <pre>
@ -587,8 +588,7 @@ final class CryptoPolicyParser {
/**
* Each crypto permission entry in the policy configuration file is
* represented by a CryptoPermissionEntry object. <p>
*
* represented by a CryptoPermissionEntry object.
* <p>
* For example, the entry
* <pre>

View File

@ -172,12 +172,10 @@ public class BuiltinClassLoader
}
/**
* Register a module this this class loader. This has the effect of making
* the types in the module visible.
* Register a module this class loader. This has the effect of making the
* types in the module visible.
*/
public void loadModule(ModuleReference mref) {
assert !VM.isModuleSystemInited();
String mn = mref.descriptor().name();
if (nameToModule.putIfAbsent(mn, mref) != null) {
throw new InternalError(mn + " already defined to this loader");
@ -191,6 +189,11 @@ public class BuiltinClassLoader
+ other.mref().descriptor().name());
}
}
// clear resources cache if VM is already initialized
if (VM.isModuleSystemInited() && resourceCache != null) {
resourceCache = null;
}
}
/**
@ -355,7 +358,10 @@ public class BuiltinClassLoader
private List<URL> findMiscResource(String name) throws IOException {
SoftReference<Map<String, List<URL>>> ref = this.resourceCache;
Map<String, List<URL>> map = (ref != null) ? ref.get() : null;
if (map != null) {
if (map == null) {
map = new ConcurrentHashMap<>();
this.resourceCache = new SoftReference<>(map);
} else {
List<URL> urls = map.get(name);
if (urls != null)
return urls;
@ -381,23 +387,18 @@ public class BuiltinClassLoader
}
}
}
return result;
return (result != null) ? result : Collections.emptyList();
}
});
} catch (PrivilegedActionException pae) {
throw (IOException) pae.getCause();
}
// only cache resources after all modules have been defined
// only cache resources after VM is fully initialized
if (VM.isModuleSystemInited()) {
if (map == null) {
map = new ConcurrentHashMap<>();
this.resourceCache = new SoftReference<>(map);
}
if (urls == null)
urls = Collections.emptyList();
map.putIfAbsent(name, urls);
}
return urls;
}

View File

@ -25,13 +25,11 @@
package jdk.internal.misc;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.module.ModuleDescriptor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URL;
import java.security.AccessControlContext;
import java.security.ProtectionDomain;
import java.util.Map;
@ -156,12 +154,6 @@ public interface JavaLangAccess {
*/
Class<?> findBootstrapClassOrNull(ClassLoader cl, String name);
/**
* Returns a URL to a resource with the given name in a module that is
* defined to the given class loader.
*/
URL findResource(ClassLoader cl, String moduleName, String name) throws IOException;
/**
* Returns the Packages for the given class loader.
*/
@ -177,6 +169,11 @@ public interface JavaLangAccess {
*/
String fastUUID(long lsb, long msb);
/**
* Record the non-exported packages of the modules in the given layer
*/
void addNonExportedPackages(ModuleLayer layer);
/**
* Invalidate package access cache
*/

View File

@ -25,6 +25,8 @@
package jdk.internal.module;
import java.util.Set;
/**
* Utility class for checking module, package, and class names.
*/
@ -45,18 +47,17 @@ public final class Checks {
int next;
int off = 0;
while ((next = name.indexOf('.', off)) != -1) {
if (isJavaIdentifier(name, off, (next - off)) == -1) {
String id = name.substring(off, next);
String id = name.substring(off, next);
if (!isJavaIdentifier(id)) {
throw new IllegalArgumentException(name + ": Invalid module name"
+ ": '" + id + "' is not a Java identifier");
}
off = next+1;
}
int last = isJavaIdentifier(name, off, name.length() - off);
if (last == -1) {
String id = name.substring(off);
String last = name.substring(off);
if (!isJavaIdentifier(last)) {
throw new IllegalArgumentException(name + ": Invalid module name"
+ ": '" + id + "' is not a Java identifier");
+ ": '" + last + "' is not a Java identifier");
}
return name;
}
@ -68,14 +69,13 @@ public final class Checks {
int next;
int off = 0;
while ((next = name.indexOf('.', off)) != -1) {
if (isJavaIdentifier(name, off, (next - off)) == -1)
String id = name.substring(off, next);
if (!isJavaIdentifier(id))
return false;
off = next+1;
}
int last = isJavaIdentifier(name, off, name.length() - off);
if (last == -1)
return false;
return true;
String last = name.substring(off);
return isJavaIdentifier(last);
}
/**
@ -144,12 +144,13 @@ public final class Checks {
int next;
int off = 0;
while ((next = name.indexOf('.', off)) != -1) {
if (isJavaIdentifier(name, off, (next - off)) == -1)
String id = name.substring(off, next);
if (!isJavaIdentifier(id))
return false;
off = next+1;
}
int count = name.length() - off;
return (isJavaIdentifier(name, off, count) != -1);
String last = name.substring(off);
return isJavaIdentifier(last);
}
/**
@ -164,76 +165,99 @@ public final class Checks {
int next;
int off = 0;
while ((next = name.indexOf('.', off)) != -1) {
if (isJavaIdentifier(name, off, (next - off)) == -1) {
String id = name.substring(off, next);
String id = name.substring(off, next);
if (!isJavaIdentifier(id)) {
throw new IllegalArgumentException(name + ": Invalid " + what
+ ": '" + id + "' is not a Java identifier");
}
off = next + 1;
}
if (isJavaIdentifier(name, off, name.length() - off) == -1) {
String id = name.substring(off, name.length());
String last = name.substring(off);
if (!isJavaIdentifier(last)) {
throw new IllegalArgumentException(name + ": Invalid " + what
+ ": '" + id + "' is not a Java identifier");
+ ": '" + last + "' is not a Java identifier");
}
return name;
}
/**
* Returns {@code true} if a given legal module name contains an identifier
* that doesn't end with a Java letter.
* Returns true if the given char sequence is a legal Java identifier,
* otherwise false.
*/
public static boolean hasJavaIdentifierWithTrailingDigit(String name) {
// quick scan to allow names that are just ASCII without digits
boolean needToParse = false;
int i = 0;
while (i < name.length()) {
int c = name.charAt(i);
if (c > 0x7F || (c >= '0' && c <= '9')) {
needToParse = true;
break;
}
i++;
}
if (!needToParse)
private static boolean isJavaIdentifier(CharSequence cs) {
if (cs.length() == 0 || RESERVED.contains(cs))
return false;
// slow path
int next;
int off = 0;
while ((next = name.indexOf('.', off)) != -1) {
int last = isJavaIdentifier(name, off, (next - off));
if (!Character.isJavaIdentifierStart(last))
return true;
off = next+1;
}
int last = isJavaIdentifier(name, off, name.length() - off);
if (!Character.isJavaIdentifierStart(last))
return true;
return false;
}
/**
* Checks if a char sequence is a legal Java identifier, returning the code
* point of the last character if legal or {@code -1} if not legal.
*/
private static int isJavaIdentifier(CharSequence cs, int offset, int count) {
if (count == 0)
return -1;
int first = Character.codePointAt(cs, offset);
int first = Character.codePointAt(cs, 0);
if (!Character.isJavaIdentifierStart(first))
return -1;
return false;
int cp = first;
int i = Character.charCount(first);
while (i < count) {
cp = Character.codePointAt(cs, offset+i);
while (i < cs.length()) {
int cp = Character.codePointAt(cs, i);
if (!Character.isJavaIdentifierPart(cp))
return -1;
return false;
i += Character.charCount(cp);
}
return cp;
return true;
}
// keywords, boolean and null literals, not allowed in identifiers
private static final Set<String> RESERVED = Set.of(
"abstract",
"assert",
"boolean",
"break",
"byte",
"case",
"catch",
"char",
"class",
"const",
"continue",
"default",
"do",
"double",
"else",
"enum",
"extends",
"final",
"finally",
"float",
"for",
"goto",
"if",
"implements",
"import",
"instanceof",
"int",
"interface",
"long",
"native",
"new",
"package",
"private",
"protected",
"public",
"return",
"short",
"static",
"strictfp",
"super",
"switch",
"synchronized",
"this",
"throw",
"throws",
"transient",
"try",
"void",
"volatile",
"while",
"true",
"false",
"null",
"_"
);
}

View File

@ -549,34 +549,26 @@ public final class ClassFileAttributes {
* u2 attribute_name_index;
* u4 attribute_length;
*
* // index to CONSTANT_utf8_info structure with the OS name
* u2 os_name_index;
* // index to CONSTANT_utf8_info structure with the OS arch
* u2 os_arch_index
* // index to CONSTANT_utf8_info structure with the target platform
* u2 target_platform_index;
* }
*
* } </pre>
*/
public static class ModuleTargetAttribute extends Attribute {
private final String osName;
private final String osArch;
private final String targetPlatform;
public ModuleTargetAttribute(String osName, String osArch) {
public ModuleTargetAttribute(String targetPlatform) {
super(MODULE_TARGET);
this.osName = osName;
this.osArch = osArch;
this.targetPlatform = targetPlatform;
}
public ModuleTargetAttribute() {
this(null, null);
this(null);
}
public String osName() {
return osName;
}
public String osArch() {
return osArch;
public String targetPlatform() {
return targetPlatform;
}
@Override
@ -588,20 +580,14 @@ public final class ClassFileAttributes {
Label[] labels)
{
String osName = null;
String osArch = null;
String targetPlatform = null;
int name_index = cr.readUnsignedShort(off);
if (name_index != 0)
osName = cr.readUTF8(off, buf);
int target_platform_index = cr.readUnsignedShort(off);
if (target_platform_index != 0)
targetPlatform = cr.readUTF8(off, buf);
off += 2;
int arch_index = cr.readUnsignedShort(off);
if (arch_index != 0)
osArch = cr.readUTF8(off, buf);
off += 2;
return new ModuleTargetAttribute(osName, osArch);
return new ModuleTargetAttribute(targetPlatform);
}
@Override
@ -613,15 +599,10 @@ public final class ClassFileAttributes {
{
ByteVector attr = new ByteVector();
int name_index = 0;
if (osName != null && osName.length() > 0)
name_index = cw.newUTF8(osName);
attr.putShort(name_index);
int arch_index = 0;
if (osArch != null && osArch.length() > 0)
arch_index = cw.newUTF8(osArch);
attr.putShort(arch_index);
int target_platform_index = 0;
if (targetPlatform != null && targetPlatform.length() > 0)
target_platform_index = cw.newUTF8(targetPlatform);
attr.putShort(target_platform_index);
return attr;
}

View File

@ -84,8 +84,9 @@ public final class ModuleBootstrap {
// The ModulePatcher for the initial configuration
private static final ModulePatcher patcher = initModulePatcher();
// ModuleFinder for the initial configuration
private static ModuleFinder initialFinder;
// ModuleFinders for the initial configuration
private static ModuleFinder unlimitedFinder;
private static ModuleFinder limitedFinder;
/**
* Returns the ModulePatcher for the initial configuration.
@ -95,11 +96,20 @@ public final class ModuleBootstrap {
}
/**
* Returns the ModuleFinder for the initial configuration
* Returns the ModuleFinder for the initial configuration before observability
* is limited by the --limit-modules command line option.
*/
public static ModuleFinder finder() {
assert initialFinder != null;
return initialFinder;
public static ModuleFinder unlimitedFinder() {
assert unlimitedFinder != null;
return unlimitedFinder;
}
/**
* Returns the ModuleFinder for the initial configuration.
*/
public static ModuleFinder limitedFinder() {
assert limitedFinder != null;
return limitedFinder;
}
/**
@ -134,6 +144,11 @@ public final class ModuleBootstrap {
PerfCounters.defineBaseTime.addElapsedTimeFrom(t1);
// special mode to boot with only java.base, ignores other options
String propValue = getAndRemoveProperty("jdk.module.minimumBoot");
if (propValue != null) {
return createMinimalBootLayer();
}
long t2 = System.nanoTime();
@ -180,7 +195,8 @@ public final class ModuleBootstrap {
}
// --limit-modules
String propValue = getAndRemoveProperty("jdk.module.limitmods");
unlimitedFinder = finder;
propValue = getAndRemoveProperty("jdk.module.limitmods");
if (propValue != null) {
Set<String> mods = new HashSet<>();
for (String mod: propValue.split(",")) {
@ -188,6 +204,7 @@ public final class ModuleBootstrap {
}
finder = limitFinder(finder, mods, roots);
}
limitedFinder = finder;
// If there is no initial module specified then assume that the initial
// module is the unnamed module of the application class loader. This
@ -267,7 +284,8 @@ public final class ModuleBootstrap {
}
PrintStream traceOutput = null;
if (Boolean.getBoolean("jdk.launcher.traceResolver"))
propValue = getAndRemoveProperty("jdk.module.showModuleResolution");
if (propValue != null && Boolean.parseBoolean(propValue))
traceOutput = System.out;
// run the resolver to create the configuration
@ -362,12 +380,23 @@ public final class ModuleBootstrap {
// total time to initialize
PerfCounters.bootstrapTime.addElapsedTimeFrom(t0);
// remember the ModuleFinder
initialFinder = finder;
return bootLayer;
}
/**
* Create a "minimal" boot module layer that only contains java.base.
*/
private static ModuleLayer createMinimalBootLayer() {
Configuration cf = SharedSecrets.getJavaLangModuleAccess()
.resolveAndBind(ModuleFinder.ofSystem(),
Set.of(JAVA_BASE),
false,
null);
Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
return ModuleLayer.empty().defineModules(cf, clf);
}
/**
* Returns a ModuleFinder that limits observability to the given root
* modules, their transitive dependences, plus a set of other modules.

View File

@ -138,7 +138,7 @@ public class ModuleHashesBuilder {
}
/*
* Utilty class
* Utility class
*/
static class Graph<T> {
private final Set<T> nodes;

View File

@ -546,21 +546,15 @@ public final class ModuleInfo {
private ModuleTarget readModuleTargetAttribute(DataInput in, ConstantPool cpool)
throws IOException
{
String osName = null;
String osArch = null;
String targetPlatform = null;
int name_index = in.readUnsignedShort();
if (name_index != 0)
osName = cpool.getUtf8(name_index);
int index = in.readUnsignedShort();
if (index != 0)
targetPlatform = cpool.getUtf8(index);
int arch_index = in.readUnsignedShort();
if (arch_index != 0)
osArch = cpool.getUtf8(arch_index);
return new ModuleTarget(osName, osArch);
return new ModuleTarget(targetPlatform);
}
/**
* Reads the ModuleHashes attribute
*/
@ -612,7 +606,6 @@ public final class ModuleInfo {
return new ModuleResolution(flags);
}
/**
* Returns true if the given attribute can be present at most once
* in the class file. Returns false otherwise.

View File

@ -62,9 +62,8 @@ public final class ModuleInfoExtender {
// the value of the ModuleMainClass attribute
private String mainClass;
// the values for the ModuleTarget attribute
private String osName;
private String osArch;
// the value for the ModuleTarget attribute
private String targetPlatform;
// the hashes for the ModuleHashes attribute
private ModuleHashes hashes;
@ -108,11 +107,10 @@ public final class ModuleInfoExtender {
}
/**
* Sets the values for the ModuleTarget attribute.
* Sets the value for the ModuleTarget attribute.
*/
public ModuleInfoExtender targetPlatform(String osName, String osArch) {
this.osName = osName;
this.osArch = osArch;
public ModuleInfoExtender targetPlatform(String targetPlatform) {
this.targetPlatform = targetPlatform;
return this;
}
@ -199,8 +197,8 @@ public final class ModuleInfoExtender {
cv.addAttribute(new ModulePackagesAttribute(packages));
if (mainClass != null)
cv.addAttribute(new ModuleMainClassAttribute(mainClass));
if (osName != null || osArch != null)
cv.addAttribute(new ModuleTargetAttribute(osName, osArch));
if (targetPlatform != null)
cv.addAttribute(new ModuleTargetAttribute(targetPlatform));
if (hashes != null)
cv.addAttribute(new ModuleHashesAttribute(hashes));
if (moduleResolution != null)

View File

@ -66,10 +66,9 @@ public final class ModuleInfoWriter {
// write ModuleMainClass if the module has a main class
md.mainClass().ifPresent(mc -> cw.visitAttribute(new ModuleMainClassAttribute(mc)));
// write ModuleTarget if there is a platform OS/arch
// write ModuleTarget if there is a target platform
if (target != null) {
cw.visitAttribute(new ModuleTargetAttribute(target.osName(),
target.osArch()));
cw.visitAttribute(new ModuleTargetAttribute(target.targetPlatform()));
}
cw.visitEnd();

View File

@ -37,36 +37,66 @@ import jdk.internal.loader.ClassLoaders;
/**
* The module to class loader map. The list of boot modules and platform modules
* are generated at build time.
* Supports the mapping of modules to class loaders. The set of modules mapped
* to the boot and platform class loaders is generated at build time from
* this source file.
*/
final class ModuleLoaderMap {
public final class ModuleLoaderMap {
/**
* Maps the system modules to the built-in class loaders.
*/
public static final class Mapper implements Function<String, ClassLoader> {
private final Map<String, ClassLoader> map;
Mapper(Map<String, ClassLoader> map) {
this.map = map; // defensive copy not needed
}
@Override
public ClassLoader apply(String name) {
return map.get(name);
}
}
/**
* Returns the names of the modules defined to the boot loader.
*/
public static Set<String> bootModules() {
// The list of boot modules generated at build time.
String[] BOOT_MODULES = new String[] { "@@BOOT_MODULE_NAMES@@" };
Set<String> bootModules = new HashSet<>(BOOT_MODULES.length);
for (String mn : BOOT_MODULES) {
bootModules.add(mn);
}
return bootModules;
}
/**
* Returns the names of the modules defined to the platform loader.
*/
public static Set<String> platformModules() {
// The list of platform modules generated at build time.
String[] PLATFORM_MODULES = new String[] { "@@PLATFORM_MODULE_NAMES@@" };
Set<String> platformModules = new HashSet<>(PLATFORM_MODULES.length);
for (String mn : PLATFORM_MODULES) {
platformModules.add(mn);
}
return platformModules;
}
/**
* Returns the function to map modules in the given configuration to the
* built-in class loaders.
*/
static Function<String, ClassLoader> mappingFunction(Configuration cf) {
// The list of boot modules and platform modules are generated at build time.
final String[] BOOT_MODULES = new String[] { "@@BOOT_MODULE_NAMES@@" };
final String[] PLATFORM_MODULES = new String[] { "@@PLATFORM_MODULE_NAMES@@" };
Set<String> bootModules = new HashSet<>(BOOT_MODULES.length);
for (String mn : BOOT_MODULES) {
bootModules.add(mn);
}
Set<String> platformModules = new HashSet<>(PLATFORM_MODULES.length);
for (String mn : PLATFORM_MODULES) {
platformModules.add(mn);
}
Set<String> bootModules = bootModules();
Set<String> platformModules = platformModules();
ClassLoader platformClassLoader = ClassLoaders.platformClassLoader();
ClassLoader appClassLoader = ClassLoaders.appClassLoader();
Map<String, ClassLoader> map = new HashMap<>();
for (ResolvedModule resolvedModule : cf.modules()) {
String mn = resolvedModule.name();
if (!bootModules.contains(mn)) {
@ -77,12 +107,6 @@ final class ModuleLoaderMap {
}
}
}
return new Function<String, ClassLoader> () {
@Override
public ClassLoader apply(String mn) {
return map.get(mn);
}
};
return new Mapper(map);
}
}

View File

@ -120,7 +120,7 @@ public final class ModulePatcher {
// JAR file - do not open as a multi-release JAR as this
// is not supported by the boot class loader
try (JarFile jf = new JarFile(file.toFile())) {
try (JarFile jf = new JarFile(file.toString())) {
jf.stream()
.filter(e -> !e.isDirectory()
&& (!isAutomatic || e.getName().endsWith(".class")))
@ -431,7 +431,7 @@ public final class ModulePatcher {
private final URL csURL;
JarResourceFinder(Path path) throws IOException {
this.jf = new JarFile(path.toFile());
this.jf = new JarFile(path.toString());
this.csURL = path.toUri().toURL();
}
@ -505,7 +505,7 @@ public final class ModulePatcher {
public Resource find(String name) throws IOException {
Path file = Resources.toFilePath(dir, name);
if (file != null) {
return newResource(name, dir, file);
return newResource(name, dir, file);
} else {
return null;
}

View File

@ -59,6 +59,7 @@ import java.util.jar.Manifest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import jdk.internal.jmod.JmodFile;
@ -315,26 +316,42 @@ public class ModulePath implements ModuleFinder {
{
try {
// exploded module
if (attrs.isDirectory()) {
return readExplodedModule(entry); // may return null
} else {
}
// JAR or JMOD file
if (attrs.isRegularFile()) {
String fn = entry.getFileName().toString();
if (attrs.isRegularFile()) {
if (fn.endsWith(".jar")) {
boolean isDefaultFileSystem = isDefaultFileSystem(entry);
// JAR file
if (fn.endsWith(".jar")) {
if (isDefaultFileSystem) {
return readJar(entry);
} else if (isLinkPhase && fn.endsWith(".jmod")) {
return readJMod(entry);
} else {
// the JAR file is in a custom file system so
// need to copy it to the local file system
Path tmpdir = Files.createTempDirectory("mlib");
Path target = Files.copy(entry, tmpdir.resolve(fn));
return readJar(target);
}
}
return null;
// JMOD file
if (isDefaultFileSystem && isLinkPhase && fn.endsWith(".jmod")) {
return readJMod(entry);
}
}
return null;
} catch (InvalidModuleDescriptorException e) {
throw new FindException("Error reading module: " + entry, e);
}
}
/**
* Returns a string with the file name of the module if possible.
* If the module location is not a file URI then return the URI
@ -434,7 +451,7 @@ public class ModulePath implements ModuleFinder {
* 3. The contents of any META-INF/services configuration files are mapped
* to "provides" declarations
* 4. The Main-Class attribute in the main attributes of the JAR manifest
* is mapped to the module descriptor mainClass
* is mapped to the module descriptor mainClass if possible
*/
private ModuleDescriptor deriveModuleDescriptor(JarFile jf)
throws IOException
@ -530,12 +547,12 @@ public class ModulePath implements ModuleFinder {
String mainClass = attrs.getValue(Attributes.Name.MAIN_CLASS);
if (mainClass != null) {
mainClass = mainClass.replace("/", ".");
String pn = packageName(mainClass);
if (!packages.contains(pn)) {
String msg = "Main-Class " + mainClass + " not in module";
throw new InvalidModuleDescriptorException(msg);
if (Checks.isClassName(mainClass)) {
String pn = packageName(mainClass);
if (packages.contains(pn)) {
builder.mainClass(mainClass);
}
}
builder.mainClass(mainClass);
}
}
@ -617,6 +634,8 @@ public class ModulePath implements ModuleFinder {
}
return ModuleReferences.newJarModule(attrs, patcher, file);
} catch (ZipException e) {
throw new FindException("Error reading " + file, e);
}
}
@ -733,6 +752,16 @@ public class ModulePath implements ModuleFinder {
}
}
/**
* Return true if a path locates a path in the default file system
*/
private boolean isDefaultFileSystem(Path path) {
return path.getFileSystem().provider()
.getScheme().equalsIgnoreCase("file");
}
private static final PerfCounter scanTime
= PerfCounter.newPerfCounter("jdk.module.finder.modulepath.scanTime");
private static final PerfCounter moduleCount

View File

@ -25,6 +25,7 @@
package jdk.internal.module;
import java.io.File;
import java.io.IOError;
import java.io.IOException;
import java.io.InputStream;
@ -226,8 +227,8 @@ class ModuleReferences {
static JarFile newJarFile(Path path) {
try {
return new JarFile(path.toFile(),
true, // verify
return new JarFile(new File(path.toString()),
true, // verify
ZipFile.OPEN_READ,
JarFile.runtimeVersion());
} catch (IOException ioe) {

View File

@ -39,6 +39,10 @@ public final class ModuleResolution {
this.value = value;
}
public int value() {
return value;
}
public static ModuleResolution empty() {
return new ModuleResolution(0);
}
@ -74,35 +78,30 @@ public final class ModuleResolution {
throw new InternalError("cannot add deprecated for removal to " + value);
return new ModuleResolution(value | WARN_DEPRECATED_FOR_REMOVAL);
}
public ModuleResolution withIncubating() {
if ((value & (WARN_DEPRECATED | WARN_DEPRECATED_FOR_REMOVAL)) != 0)
throw new InternalError("cannot add incubating to " + value);
return new ModuleResolution(value | WARN_INCUBATING);
}
public int value() {
return value;
}
public static boolean doNotResolveByDefault(ModuleReference mref) {
// get the DO_NOT_RESOLVE_BY_DEFAULT flag, if any
if (!(mref instanceof ModuleReferenceImpl))
return false;
ModuleResolution mres = ((ModuleReferenceImpl)mref).moduleResolution();
if (mres != null)
return mres.doNotResolveByDefault();
if (mref instanceof ModuleReferenceImpl) {
ModuleResolution mres = ((ModuleReferenceImpl) mref).moduleResolution();
if (mres != null)
return mres.doNotResolveByDefault();
}
return false;
}
public static boolean hasIncubatingWarning(ModuleReference mref) {
if (!(mref instanceof ModuleReferenceImpl))
return false;
ModuleResolution mres = ((ModuleReferenceImpl)mref).moduleResolution();
if (mres != null)
return mres.hasIncubatingWarning();
if (mref instanceof ModuleReferenceImpl) {
ModuleResolution mres = ((ModuleReferenceImpl) mref).moduleResolution();
if (mres != null)
return mres.hasIncubatingWarning();
}
return false;
}

View File

@ -25,22 +25,21 @@
package jdk.internal.module;
/**
* Represents the module target.
*
* For now, this is a single value for the target platform, e.g. "linux-x64".
*/
public final class ModuleTarget {
private final String osName;
private final String osArch;
private final String targetPlatform;
public ModuleTarget(String osName, String osArch) {
this.osName = osName;
this.osArch = osArch;
public ModuleTarget(String targetPlatform) {
this.targetPlatform = targetPlatform;
}
public String osName() {
return osName;
}
public String osArch() {
return osArch;
public String targetPlatform() {
return targetPlatform;
}
}

View File

@ -25,12 +25,22 @@
package jdk.internal.module;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.lang.module.ResolvedModule;
import java.net.URI;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import jdk.internal.loader.BootLoader;
import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.loader.ClassLoaders;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
@ -38,8 +48,8 @@ import jdk.internal.misc.SharedSecrets;
/**
* A helper class for creating and updating modules. This class is intended to
* support command-line options, tests, and the instrumentation API. It is also
* used by the VM to add read edges when agents are instrumenting code that
* need to link to supporting classes.
* used by the VM to load modules or add read edges when agents are instrumenting
* code that need to link to supporting classes.
*
* The parameters that are package names in this API are the fully-qualified
* names of the packages as defined in section 6.5.3 of <cite>The Java&trade;
@ -154,4 +164,90 @@ public class Modules {
addReads(m, BootLoader.getUnnamedModule());
addReads(m, ClassLoaders.appClassLoader().getUnnamedModule());
}
/**
* Called by the VM to load a system module, typically "java.instrument" or
* "jdk.management.agent". If the module is not loaded then it is resolved
* and loaded (along with any dependences that weren't previously loaded)
* into a child layer.
*/
public static synchronized Module loadModule(String name) {
ModuleLayer top = topLayer;
if (top == null)
top = ModuleLayer.boot();
Module module = top.findModule(name).orElse(null);
if (module != null) {
// module already loaded
return module;
}
// resolve the module with the top-most layer as the parent
ModuleFinder empty = ModuleFinder.of();
ModuleFinder finder = ModuleBootstrap.unlimitedFinder();
Set<String> roots = Set.of(name);
Configuration cf = top.configuration().resolveAndBind(empty, finder, roots);
// create the child layer
Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
ModuleLayer newLayer = top.defineModules(cf, clf);
// add qualified exports/opens to give access to modules in child layer
Map<String, Module> map = newLayer.modules().stream()
.collect(Collectors.toMap(Module::getName,
Function.identity()));
ModuleLayer layer = top;
while (layer != null) {
for (Module m : layer.modules()) {
// qualified exports
m.getDescriptor().exports().stream()
.filter(ModuleDescriptor.Exports::isQualified)
.forEach(e -> e.targets().forEach(target -> {
Module other = map.get(target);
if (other != null) {
addExports(m, e.source(), other);
}}));
// qualified opens
m.getDescriptor().opens().stream()
.filter(ModuleDescriptor.Opens::isQualified)
.forEach(o -> o.targets().forEach(target -> {
Module other = map.get(target);
if (other != null) {
addOpens(m, o.source(), other);
}}));
}
List<ModuleLayer> parents = layer.parents();
assert parents.size() <= 1;
layer = parents.isEmpty() ? null : parents.get(0);
}
// update security manager before making types visible
JLA.addNonExportedPackages(newLayer);
// update the built-in class loaders to make the types visible
for (ResolvedModule resolvedModule : cf.modules()) {
ModuleReference mref = resolvedModule.reference();
String mn = mref.descriptor().name();
ClassLoader cl = clf.apply(mn);
if (cl == null) {
BootLoader.loadModule(mref);
} else {
((BuiltinClassLoader) cl).loadModule(mref);
}
}
// new top layer
topLayer = newLayer;
// return module
return newLayer.findModule(name)
.orElseThrow(() -> new InternalError("module not loaded"));
}
// the top-most system layer
private static ModuleLayer topLayer;
}

View File

@ -26,10 +26,10 @@ package jdk.internal.module;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
/**
@ -94,7 +94,7 @@ public final class Resources {
if (expectDirectory) {
name = name.substring(0, name.length() - 1); // drop trailing "/"
}
Path path = toSafeFilePath(name);
Path path = toSafeFilePath(dir.getFileSystem(), name);
if (path != null) {
Path file = dir.resolve(path);
try {
@ -116,7 +116,7 @@ public final class Resources {
* are rejected, as are resource names that translates to a file path
* with a root component.
*/
private static Path toSafeFilePath(String name) {
private static Path toSafeFilePath(FileSystem fs, String name) {
// scan elements of resource name
int next;
int off = 0;
@ -135,12 +135,12 @@ public final class Resources {
// convert to file path
Path path;
if (File.separatorChar == '/') {
path = Paths.get(name);
path = fs.getPath(name);
} else {
// not allowed to embed file separators
if (name.contains(File.separator))
return null;
path = Paths.get(name.replace('/', File.separatorChar));
path = fs.getPath(name.replace('/', File.separatorChar));
}
// file path not allowed to have root component

View File

@ -31,6 +31,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.loader.ClassLoaders;
import jdk.internal.misc.VM;
/** Common utility routines used by both java.lang and
@ -315,23 +316,13 @@ public class Reflection {
*/
public static boolean isCallerSensitive(Method m) {
final ClassLoader loader = m.getDeclaringClass().getClassLoader();
if (VM.isSystemDomainLoader(loader) || isExtClassLoader(loader)) {
if (VM.isSystemDomainLoader(loader) ||
loader == ClassLoaders.platformClassLoader()) {
return m.isAnnotationPresent(CallerSensitive.class);
}
return false;
}
private static boolean isExtClassLoader(ClassLoader loader) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
while (cl != null) {
if (cl.getParent() == null && cl == loader) {
return true;
}
cl = cl.getParent();
}
return false;
}
/**
* Returns an IllegalAccessException with an exception message based on
* the access that is denied.

View File

@ -135,6 +135,24 @@ public class ReflectionFactory {
return soleInstance;
}
/**
* Returns an alternate reflective Method instance for the given method
* intended for reflection to invoke, if present.
*
* A trusted method can define an alternate implementation for a method `foo`
* by defining a method named "reflected$foo" that will be invoked
* reflectively.
*/
private static Method findMethodForReflection(Method method) {
String altName = "reflected$" + method.getName();
try {
return method.getDeclaringClass()
.getDeclaredMethod(altName, method.getParameterTypes());
} catch (NoSuchMethodException ex) {
return null;
}
}
//--------------------------------------------------------------------------
//
// Routines used by java.lang.reflect
@ -161,6 +179,13 @@ public class ReflectionFactory {
public MethodAccessor newMethodAccessor(Method method) {
checkInitted();
if (Reflection.isCallerSensitive(method)) {
Method altMethod = findMethodForReflection(method);
if (altMethod != null) {
method = altMethod;
}
}
if (noInflation && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
return new MethodAccessorGenerator().
generateMethod(method.getDeclaringClass(),

View File

@ -161,6 +161,7 @@ module java.base {
java.security.jgss,
java.sql,
java.xml,
jdk.attach,
jdk.charsets,
jdk.compiler, // reflective dependency
jdk.incubator.httpclient,

View File

@ -43,13 +43,17 @@ import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.lang.module.Configuration;
import java.lang.module.FindException;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Requires;
import java.lang.module.ModuleDescriptor.Exports;
import java.lang.module.ModuleDescriptor.Opens;
import java.lang.module.ModuleDescriptor.Provides;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.lang.module.ResolvedModule;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
@ -58,14 +62,16 @@ import java.net.URI;
import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.text.Normalizer;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@ -83,6 +89,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import jdk.internal.misc.VM;
import jdk.internal.module.ModuleBootstrap;
import jdk.internal.module.Modules;
@ -98,6 +105,7 @@ public final class LauncherHelper {
"javafx.application.Application";
private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX =
"sun.launcher.LauncherHelper$FXHelper";
private static final String LAUNCHER_AGENT_CLASS = "Launcher-Agent-Class";
private static final String MAIN_CLASS = "Main-Class";
private static final String ADD_EXPORTS = "Add-Exports";
private static final String ADD_OPENS = "Add-Opens";
@ -408,8 +416,12 @@ public final class LauncherHelper {
ostream = (printToStderr) ? System.err : System.out;
}
static void initOutput(PrintStream ps) {
ostream = ps;
}
static String getMainClassFromJar(String jarname) {
String mainValue = null;
String mainValue;
try (JarFile jarFile = new JarFile(jarname)) {
Manifest manifest = jarFile.getManifest();
if (manifest == null) {
@ -426,6 +438,22 @@ public final class LauncherHelper {
abort(null, "java.launcher.jar.error3", jarname);
}
// Launcher-Agent-Class (only check for this when Main-Class present)
String agentClass = mainAttrs.getValue(LAUNCHER_AGENT_CLASS);
if (agentClass != null) {
ModuleLayer.boot().findModule("java.instrument").ifPresent(m -> {
try {
String cn = "sun.instrument.InstrumentationImpl";
Class<?> clazz = Class.forName(cn, false, null);
Method loadAgent = clazz.getMethod("loadAgent", String.class);
loadAgent.invoke(null, jarname);
} catch (Throwable e) {
if (e instanceof InvocationTargetException) e = e.getCause();
abort(e, "java.launcher.jar.error4", jarname);
}
});
}
// Add-Exports and Add-Opens
String exports = mainAttrs.getValue(ADD_EXPORTS);
if (exports != null) {
@ -913,141 +941,350 @@ public final class LauncherHelper {
}
}
private static void formatCommaList(PrintStream out,
String prefix,
Collection<?> list)
{
if (list.isEmpty())
return;
out.format("%s", prefix);
boolean first = true;
for (Object ob : list) {
if (first) {
out.format(" %s", ob);
first = false;
} else {
out.format(", %s", ob);
}
}
out.format("%n");
}
/**
* Called by the launcher to list the observable modules.
* If called without any sub-options then the output is a simple list of
* the modules. If called with sub-options then the sub-options are the
* names of the modules to list (e.g. --list-modules java.base,java.desktop)
*/
static void listModules(boolean printToStderr, String optionFlag)
throws IOException, ClassNotFoundException
{
initOutput(printToStderr);
static void listModules() {
initOutput(System.out);
ModuleFinder finder = jdk.internal.module.ModuleBootstrap.finder();
int colon = optionFlag.indexOf('=');
if (colon == -1) {
finder.findAll().stream()
.sorted(Comparator.comparing(ModuleReference::descriptor))
.forEach(mref -> describeModule(finder, mref, false));
} else {
String[] names = optionFlag.substring(colon+1).split(",");
for (String name: names) {
ModuleReference mref = finder.find(name).orElse(null);
if (mref == null) {
System.err.format("%s not found%n", name);
continue;
}
describeModule(finder, mref, true);
}
}
ModuleBootstrap.limitedFinder().findAll().stream()
.sorted(new JrtFirstComparator())
.forEach(LauncherHelper::showModule);
}
/**
* Describes the given module.
* Called by the launcher to show the resolved modules
*/
static void describeModule(ModuleFinder finder,
ModuleReference mref,
boolean verbose)
{
ModuleDescriptor md = mref.descriptor();
ostream.print("module " + midAndLocation(md, mref.location()));
if (md.isAutomatic())
ostream.print(" automatic");
ostream.println();
static void showResolvedModules() {
initOutput(System.out);
if (!verbose)
return;
ModuleLayer bootLayer = ModuleLayer.boot();
Configuration cf = bootLayer.configuration();
cf.modules().stream()
.map(ResolvedModule::reference)
.sorted(new JrtFirstComparator())
.forEach(LauncherHelper::showModule);
}
/**
* Called by the launcher to describe a module
*/
static void describeModule(String moduleName) {
initOutput(System.out);
ModuleFinder finder = ModuleBootstrap.limitedFinder();
ModuleReference mref = finder.find(moduleName).orElse(null);
if (mref == null) {
abort(null, "java.launcher.module.error4", moduleName);
}
ModuleDescriptor md = mref.descriptor();
// one-line summary
showModule(mref);
// unqualified exports (sorted by package)
Set<Exports> exports = new TreeSet<>(Comparator.comparing(Exports::source));
md.exports().stream().filter(e -> !e.isQualified()).forEach(exports::add);
for (Exports e : exports) {
String modsAndSource = Stream.concat(toStringStream(e.modifiers()),
Stream.of(e.source()))
md.exports().stream()
.filter(e -> !e.isQualified())
.sorted(Comparator.comparing(Exports::source))
.map(e -> Stream.concat(Stream.of(e.source()),
toStringStream(e.modifiers()))
.collect(Collectors.joining(" ")))
.forEach(sourceAndMods -> ostream.format("exports %s%n", sourceAndMods));
// dependences
for (Requires r : md.requires()) {
String nameAndMods = Stream.concat(Stream.of(r.name()),
toStringStream(r.modifiers()))
.collect(Collectors.joining(" "));
ostream.format(" exports %s%n", modsAndSource);
ostream.format("requires %s", nameAndMods);
finder.find(r.name())
.map(ModuleReference::descriptor)
.filter(ModuleDescriptor::isAutomatic)
.ifPresent(any -> ostream.print(" automatic"));
ostream.println();
}
for (Requires d : md.requires()) {
ostream.format(" requires %s", d);
String suffix = finder.find(d.name())
.map(ModuleReference::descriptor)
.map(any -> any.isAutomatic() ? " automatic" : "")
.orElse(" not found");
ostream.println(suffix);
}
// service use and provides
for (String s : md.uses()) {
ostream.format(" uses %s%n", s);
ostream.format("uses %s%n", s);
}
for (Provides ps : md.provides()) {
ostream.format(" provides %s with %s%n", ps.service(),
ps.providers().stream().collect(Collectors.joining(", ")));
String names = ps.providers().stream().collect(Collectors.joining(" "));
ostream.format("provides %s with %s%n", ps.service(), names);
}
// qualified exports
for (Exports e : md.exports()) {
if (e.isQualified()) {
String modsAndSource = Stream.concat(toStringStream(e.modifiers()),
Stream.of(e.source()))
.collect(Collectors.joining(" "));
ostream.format(" exports %s", modsAndSource);
formatCommaList(ostream, " to", e.targets());
String who = e.targets().stream().collect(Collectors.joining(" "));
ostream.format("qualified exports %s to %s%n", e.source(), who);
}
}
// open packages
for (Opens obj: md.opens()) {
String modsAndSource = Stream.concat(toStringStream(obj.modifiers()),
Stream.of(obj.source()))
for (Opens opens: md.opens()) {
if (opens.isQualified())
ostream.print("qualified ");
String sourceAndMods = Stream.concat(Stream.of(opens.source()),
toStringStream(opens.modifiers()))
.collect(Collectors.joining(" "));
ostream.format(" opens %s", modsAndSource);
if (obj.isQualified())
formatCommaList(ostream, " to", obj.targets());
else
ostream.println();
ostream.format("opens %s", sourceAndMods);
if (opens.isQualified()) {
String who = opens.targets().stream().collect(Collectors.joining(" "));
ostream.format(" to %s", who);
}
ostream.println();
}
// non-exported/non-open packages
Set<String> concealed = new TreeSet<>(md.packages());
md.exports().stream().map(Exports::source).forEach(concealed::remove);
md.opens().stream().map(Opens::source).forEach(concealed::remove);
concealed.forEach(p -> ostream.format(" contains %s%n", p));
concealed.forEach(p -> ostream.format("contains %s%n", p));
}
static <T> String toString(Set<T> s) {
return toStringStream(s).collect(Collectors.joining(" "));
/**
* Prints a single line with the module name, version and modifiers
*/
private static void showModule(ModuleReference mref) {
ModuleDescriptor md = mref.descriptor();
ostream.print(md.toNameAndVersion());
mref.location()
.filter(uri -> !isJrt(uri))
.ifPresent(uri -> ostream.format(" %s", uri));
if (md.isOpen())
ostream.print(" open");
if (md.isAutomatic())
ostream.print(" automatic");
ostream.println();
}
static <T> Stream<String> toStringStream(Set<T> s) {
/**
* A ModuleReference comparator that considers modules in the run-time
* image to be less than modules than not in the run-time image.
*/
private static class JrtFirstComparator implements Comparator<ModuleReference> {
private final Comparator<ModuleReference> real;
JrtFirstComparator() {
this.real = Comparator.comparing(ModuleReference::descriptor);
}
@Override
public int compare(ModuleReference a, ModuleReference b) {
if (isJrt(a)) {
return isJrt(b) ? real.compare(a, b) : -1;
} else {
return isJrt(b) ? 1 : real.compare(a, b);
}
}
}
private static <T> Stream<String> toStringStream(Set<T> s) {
return s.stream().map(e -> e.toString().toLowerCase());
}
static String midAndLocation(ModuleDescriptor md, Optional<URI> location ) {
URI loc = location.orElse(null);
if (loc == null || loc.getScheme().equalsIgnoreCase("jrt"))
return md.toNameAndVersion();
else
return md.toNameAndVersion() + " (" + loc + ")";
private static boolean isJrt(ModuleReference mref) {
return isJrt(mref.location().orElse(null));
}
private static boolean isJrt(URI uri) {
return (uri != null && uri.getScheme().equalsIgnoreCase("jrt"));
}
/**
* Called by the launcher to validate the modules on the upgrade and
* application module paths.
*
* @return {@code true} if no errors are found
*/
private static boolean validateModules() {
initOutput(System.out);
ModuleValidator validator = new ModuleValidator();
// upgrade module path
String value = System.getProperty("jdk.module.upgrade.path");
if (value != null) {
Stream.of(value.split(File.pathSeparator))
.map(Paths::get)
.forEach(validator::scan);
}
// system modules
ModuleFinder.ofSystem().findAll().stream()
.sorted(Comparator.comparing(ModuleReference::descriptor))
.forEach(validator::process);
// application module path
value = System.getProperty("jdk.module.path");
if (value != null) {
Stream.of(value.split(File.pathSeparator))
.map(Paths::get)
.forEach(validator::scan);
}
return !validator.foundErrors();
}
/**
* A simple validator to check for errors and conflicts between modules.
*/
static class ModuleValidator {
private static final String MODULE_INFO = "module-info.class";
private Map<String, ModuleReference> nameToModule = new HashMap<>();
private Map<String, ModuleReference> packageToModule = new HashMap<>();
private boolean errorFound;
/**
* Returns true if at least one error was found
*/
boolean foundErrors() {
return errorFound;
}
/**
* Prints the module location and name.
*/
private void printModule(ModuleReference mref) {
mref.location()
.filter(uri -> !isJrt(uri))
.ifPresent(uri -> ostream.print(uri + " "));
ModuleDescriptor descriptor = mref.descriptor();
ostream.print(descriptor.name());
if (descriptor.isAutomatic())
ostream.print(" automatic");
ostream.println();
}
/**
* Prints the module location and name, checks if the module is
* shadowed by a previously seen module, and finally checks for
* package conflicts with previously seen modules.
*/
void process(ModuleReference mref) {
printModule(mref);
String name = mref.descriptor().name();
ModuleReference previous = nameToModule.putIfAbsent(name, mref);
if (previous != null) {
ostream.print(INDENT + "shadowed by ");
printModule(previous);
} else {
// check for package conflicts when not shadowed
for (String pkg : mref.descriptor().packages()) {
previous = packageToModule.putIfAbsent(pkg, mref);
if (previous != null) {
String mn = previous.descriptor().name();
ostream.println(INDENT + "contains " + pkg
+ " conflicts with module " + mn);
errorFound = true;
}
}
}
}
/**
* Scan an element on a module path. The element is a directory
* of modules, an exploded module, or a JAR file.
*/
void scan(Path entry) {
BasicFileAttributes attrs;
try {
attrs = Files.readAttributes(entry, BasicFileAttributes.class);
} catch (NoSuchFileException ignore) {
return;
} catch (IOException ioe) {
ostream.println(entry + " " + ioe);
errorFound = true;
return;
}
String fn = entry.getFileName().toString();
if (attrs.isRegularFile() && fn.endsWith(".jar")) {
// JAR file, explicit or automatic module
scanModule(entry).ifPresent(this::process);
} else if (attrs.isDirectory()) {
Path mi = entry.resolve(MODULE_INFO);
if (Files.exists(mi)) {
// exploded module
scanModule(entry).ifPresent(this::process);
} else {
// directory of modules
scanDirectory(entry);
}
}
}
/**
* Scan the JAR files and exploded modules in a directory.
*/
private void scanDirectory(Path dir) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
Map<String, Path> moduleToEntry = new HashMap<>();
for (Path entry : stream) {
BasicFileAttributes attrs;
try {
attrs = Files.readAttributes(entry, BasicFileAttributes.class);
} catch (IOException ioe) {
ostream.println(entry + " " + ioe);
errorFound = true;
continue;
}
ModuleReference mref = null;
String fn = entry.getFileName().toString();
if (attrs.isRegularFile() && fn.endsWith(".jar")) {
mref = scanModule(entry).orElse(null);
} else if (attrs.isDirectory()) {
Path mi = entry.resolve(MODULE_INFO);
if (Files.exists(mi)) {
mref = scanModule(entry).orElse(null);
}
}
if (mref != null) {
String name = mref.descriptor().name();
Path previous = moduleToEntry.putIfAbsent(name, entry);
if (previous != null) {
// same name as other module in the directory
printModule(mref);
ostream.println(INDENT + "contains same module as "
+ previous.getFileName());
errorFound = true;
} else {
process(mref);
}
}
}
} catch (IOException ioe) {
ostream.println(dir + " " + ioe);
errorFound = true;
}
}
/**
* Scan a JAR file or exploded module.
*/
private Optional<ModuleReference> scanModule(Path entry) {
ModuleFinder finder = ModuleFinder.of(entry);
try {
return finder.findAll().stream().findFirst();
} catch (FindException e) {
ostream.println(entry);
ostream.println(INDENT + e.getMessage());
Throwable cause = e.getCause();
if (cause != null) {
ostream.println(INDENT + cause);
}
errorFound = true;
return Optional.empty();
}
}
}
}

View File

@ -53,26 +53,33 @@ java.launcher.opt.footer = \
\ A {0} separated list of directories, each directory\n\
\ is a directory of modules that replace upgradeable\n\
\ modules in the runtime image\n\
\ --add-modules <modulename>[,<modulename>...]\n\
\ --add-modules <module name>[,<module name>...]\n\
\ root modules to resolve in addition to the initial module.\n\
\ <modulename> can also be ALL-DEFAULT, ALL-SYSTEM,\n\
\ <module name> can also be ALL-DEFAULT, ALL-SYSTEM,\n\
\ ALL-MODULE-PATH.\n\
\ --limit-modules <modulename>[,<modulename>...]\n\
\ limit the universe of observable modules\n\
\ --list-modules [<modulename>[,<modulename>...]]\n\
\ list the observable modules and exit\n\
\ --dry-run create VM but do not execute main method.\n\
\ This --dry-run option may be useful for validating the\n\
\ --list-modules\n\
\ list observable modules and exit\n\
\ --d <module name>\n\
\ --describe-module <module name>\n\
\ describe a module and exit\n\
\ --dry-run create VM and load main class but do not execute main method.\n\
\ The --dry-run option may be useful for validating the\n\
\ command-line options such as the module system configuration.\n\
\ --validate-modules\n\
\ validate all modules and exit\n\
\ The --validate-modules option may be useful for finding\n\
\ conflicts and other errors with modules on the module path.\n\
\ -D<name>=<value>\n\
\ set a system property\n\
\ -verbose:[class|gc|jni]\n\
\ -verbose:[class|module|gc|jni]\n\
\ enable verbose output\n\
\ -version print product version to the error stream and exit\n\
\ --version print product version to the output stream and exit\n\
\ -showversion print product version to the error stream and continue\n\
\ --show-version\n\
\ print product version to the output stream and continue\n\
\ --show-module-resolution\n\
\ show module resolution output during startup\n\
\ -? -h -help\n\
\ print this help message to the error stream\n\
\ --help print this help message to the output stream\n\
@ -119,7 +126,6 @@ java.launcher.X.usage=\n\
\ -Xcomp forces compilation of methods on first invocation\n\
\ -Xdebug provided for backward compatibility\n\
\ -Xdiag show additional diagnostic messages\n\
\ -Xdiag:resolver show resolver diagnostic messages\n\
\ -Xfuture enable strictest checks, anticipating future default\n\
\ -Xint interpreted mode execution only\n\
\ -Xinternalversion\n\
@ -164,10 +170,12 @@ java.launcher.X.usage=\n\
\ permit illegal access to members of types in named modules\n\
\ by code in unnamed modules. This compatibility option will\n\
\ be removed in the next release.\n\
\ --disable-@files disable further argument file expansion\n\
\ --limit-modules <module name>[,<module name>...]\n\
\ limit the universe of observable modules\n\
\ --patch-module <module>=<file>({0}<file>)*\n\
\ Override or augment a module with classes and resources\n\
\ in JAR files or directories.\n\n\
\ override or augment a module with classes and resources\n\
\ in JAR files or directories.\n\
\ --disable-@files disable further argument file expansion\n\n\
These extra options are subject to change without notice.\n
# Translators please note do not translate the options themselves
@ -204,6 +212,7 @@ java.launcher.jar.error1=\
Error: An unexpected error occurred while trying to open file {0}
java.launcher.jar.error2=manifest not found in {0}
java.launcher.jar.error3=no main manifest attribute, in {0}
java.launcher.jar.error4=error loading java agent in {0}
java.launcher.init.error=initialization error
java.launcher.javafx.error1=\
Error: The JavaFX launchApplication method has the wrong signature, it\n\
@ -215,4 +224,5 @@ java.launcher.module.error2=\
java.launcher.module.error3=\
Error: Unable to load main class {0} from module {1}\n\
\t{2}
java.launcher.module.error4=\
{0} not found

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -47,4 +47,3 @@ typedef long long s8;
#endif
#endif // LIBJIMAGE_INTTYPES_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -202,4 +202,3 @@ extern "C" bool JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locatio
typedef bool (*JImage_ResourcePath_t)(JImageFile* jimage, JImageLocationRef location,
char* buffer, jlong size);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -43,13 +43,14 @@
#define ARG_ERROR2 "Error: %s requires jar file specification"
#define ARG_ERROR3 "Error: The -J option should not be followed by a space."
#define ARG_ERROR4 "Error: %s requires module path specification"
#define ARG_ERROR5 "Error: %s requires module id"
#define ARG_ERROR5 "Error: %s requires module name"
#define ARG_ERROR6 "Error: %s requires modules to be specified"
#define ARG_ERROR7 "Error: %s can only be specified once"
#define ARG_ERROR8 "Error: Unmatched quote in environment variable %s"
#define ARG_ERROR9 "Error: Option %s is not allowed in environment variable %s"
#define ARG_ERROR10 "Error: Option %s in %s is not allowed in environment variable %s"
#define ARG_ERROR11 "Error: Cannot specify main class in environment variable %s"
#define ARG_ERROR12 "Error: %s requires module name"
#define JVM_ERROR1 "Error: Could not create the Java Virtual Machine.\n" GEN_ERROR
#define JVM_ERROR2 "Error: Could not detach main thread.\n" JNI_ERROR

View File

@ -71,7 +71,10 @@ static jboolean printTo = USE_STDERR; /* where to print version/usage */
static jboolean printXUsage = JNI_FALSE; /* print and exit*/
static jboolean dryRun = JNI_FALSE; /* initialize VM and exit */
static char *showSettings = NULL; /* print but continue */
static char *listModules = NULL;
static jboolean showResolvedModules = JNI_FALSE;
static jboolean listModules = JNI_FALSE;
static char *describeModule = NULL;
static jboolean validateModules = JNI_FALSE;
static const char *_program_name;
static const char *_launcher_name;
@ -118,7 +121,10 @@ static void SetApplicationClassPath(const char**);
static void PrintJavaVersion(JNIEnv *env, jboolean extraLF);
static void PrintUsage(JNIEnv* env, jboolean doXUsage);
static void ShowSettings(JNIEnv* env, char *optString);
static void ListModules(JNIEnv* env, char *optString);
static void ShowResolvedModules(JNIEnv* env);
static void ListModules(JNIEnv* env);
static void DescribeModule(JNIEnv* env, char* optString);
static jboolean ValidateModules(JNIEnv* env);
static void SetPaths(int argc, char **argv);
@ -408,9 +414,31 @@ JavaMain(void * _args)
CHECK_EXCEPTION_LEAVE(1);
}
if (listModules != NULL) {
ListModules(env, listModules);
// show resolved modules and continue
if (showResolvedModules) {
ShowResolvedModules(env);
CHECK_EXCEPTION_LEAVE(1);
}
// list observable modules, then exit
if (listModules) {
ListModules(env);
CHECK_EXCEPTION_LEAVE(1);
LEAVE();
}
// describe a module, then exit
if (describeModule != NULL) {
DescribeModule(env, describeModule);
CHECK_EXCEPTION_LEAVE(1);
LEAVE();
}
// validate modules on the module path, then exit
if (validateModules) {
jboolean okay = ValidateModules(env);
CHECK_EXCEPTION_LEAVE(1);
if (!okay) ret = 1;
LEAVE();
}
@ -551,7 +579,8 @@ static jboolean
IsLauncherOption(const char* name) {
return IsClassPathOption(name) ||
IsLauncherMainOption(name) ||
JLI_StrCmp(name, "--list-modules") == 0;
JLI_StrCmp(name, "--describe-module") == 0 ||
JLI_StrCmp(name, "-d") == 0;
}
/*
@ -1194,7 +1223,7 @@ GetOpt(int *pargc, char ***pargv, char **poption, char **pvalue) {
} else if (JLI_StrCCmp(arg, "--") == 0 && (equals = JLI_StrChr(arg, '=')) != NULL) {
value = equals+1;
if (JLI_StrCCmp(arg, "--list-modules=") == 0 ||
if (JLI_StrCCmp(arg, "--describe-module=") == 0 ||
JLI_StrCCmp(arg, "--module=") == 0 ||
JLI_StrCCmp(arg, "--class-path=") == 0) {
kind = LAUNCHER_OPTION_WITH_ARGUMENT;
@ -1258,18 +1287,18 @@ ParseArguments(int *pargc, char ***pargv,
REPORT_ERROR (has_arg_any_len, ARG_ERROR1, arg);
SetClassPath(value);
mode = LM_CLASS;
} else if (JLI_StrCmp(arg, "--list-modules") == 0 ||
JLI_StrCCmp(arg, "--list-modules=") == 0) {
listModules = arg;
// set listModules to --list-modules=<module-names> if argument is specified
if (JLI_StrCmp(arg, "--list-modules") == 0 && has_arg) {
static const char format[] = "%s=%s";
size_t buflen = JLI_StrLen(option) + 2 + JLI_StrLen(value);
listModules = JLI_MemAlloc(buflen);
JLI_Snprintf(listModules, buflen, format, option, value);
}
return JNI_TRUE;
} else if (JLI_StrCmp(arg, "--list-modules") == 0) {
listModules = JNI_TRUE;
} else if (JLI_StrCmp(arg, "--show-resolved-modules") == 0) {
showResolvedModules = JNI_TRUE;
} else if (JLI_StrCmp(arg, "--validate-modules") == 0) {
AddOption("-Djdk.module.minimumBoot=true", NULL);
validateModules = JNI_TRUE;
} else if (JLI_StrCmp(arg, "--describe-module") == 0 ||
JLI_StrCCmp(arg, "--describe-module=") == 0 ||
JLI_StrCmp(arg, "-d") == 0) {
REPORT_ERROR (has_arg_any_len, ARG_ERROR12, arg);
describeModule = value;
/*
* Parse white-space options
*/
@ -1331,9 +1360,8 @@ ParseArguments(int *pargc, char ***pargv,
showSettings = arg;
} else if (JLI_StrCmp(arg, "-Xdiag") == 0) {
AddOption("-Dsun.java.launcher.diag=true", NULL);
AddOption("-Djdk.launcher.traceResolver=true", NULL);
} else if (JLI_StrCmp(arg, "-Xdiag:resolver") == 0) {
AddOption("-Djdk.launcher.traceResolver=true", NULL);
} else if (JLI_StrCmp(arg, "--show-module-resolution") == 0) {
AddOption("-Djdk.module.showModuleResolution=true", NULL);
/*
* The following case provide backward compatibility with old-style
* command line options.
@ -1392,7 +1420,10 @@ ParseArguments(int *pargc, char ***pargv,
}
if (*pwhat == NULL) {
*pret = 1;
/* LM_UNKNOWN okay for options that exit */
if (!listModules && !describeModule && !validateModules) {
*pret = 1;
}
} else if (mode == LM_UNKNOWN) {
/* default to LM_CLASS if -m, -jar and -cp options are
* not specified */
@ -1821,21 +1852,61 @@ ShowSettings(JNIEnv *env, char *optString)
}
/**
* List modules supported by the runtime
* Show resolved modules
*/
static void
ListModules(JNIEnv *env, char *optString)
ShowResolvedModules(JNIEnv *env)
{
jmethodID showResolvedModulesID;
jclass cls = GetLauncherHelperClass(env);
NULL_CHECK(cls);
NULL_CHECK(showResolvedModulesID = (*env)->GetStaticMethodID(env, cls,
"showResolvedModules", "()V"));
(*env)->CallStaticVoidMethod(env, cls, showResolvedModulesID);
}
/**
* List observable modules
*/
static void
ListModules(JNIEnv *env)
{
jmethodID listModulesID;
jstring joptString = NULL;
jclass cls = GetLauncherHelperClass(env);
NULL_CHECK(cls);
NULL_CHECK(listModulesID = (*env)->GetStaticMethodID(env, cls,
"listModules", "(ZLjava/lang/String;)V"));
"listModules", "()V"));
(*env)->CallStaticVoidMethod(env, cls, listModulesID);
}
/**
* Describe a module
*/
static void
DescribeModule(JNIEnv *env, char *optString)
{
jmethodID describeModuleID;
jstring joptString = NULL;
jclass cls = GetLauncherHelperClass(env);
NULL_CHECK(cls);
NULL_CHECK(describeModuleID = (*env)->GetStaticMethodID(env, cls,
"describeModule", "(Ljava/lang/String;)V"));
NULL_CHECK(joptString = (*env)->NewStringUTF(env, optString));
(*env)->CallStaticVoidMethod(env, cls, listModulesID,
USE_STDOUT,
joptString);
(*env)->CallStaticVoidMethod(env, cls, describeModuleID, joptString);
}
/**
* Validate modules
*/
static jboolean
ValidateModules(JNIEnv *env)
{
jmethodID validateModulesID;
jclass cls = GetLauncherHelperClass(env);
NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
validateModulesID = (*env)->GetStaticMethodID(env, cls, "validateModules", "()Z");
NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
return (*env)->CallStaticBooleanMethod(env, cls, validateModulesID);
}
/*

View File

@ -37,7 +37,7 @@ extern "C" {
#endif
/*
* Mac OS X specific declarations for AWT native interface.
* MacOS specific declarations for AWT native interface.
* See notes in jawt.h for an example of use.
*/

View File

@ -339,11 +339,16 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
public Dimension getMinimumSize( JComponent c ) {
Dimension d = super.getMinimumSize(c);
if (XPStyle.getXP() != null) {
d.width += 5;
d.width += 7;
boolean isEditable = false;
if (c instanceof JComboBox) {
isEditable = ((JComboBox) c).isEditable();
}
d.height += isEditable ? 4 : 6;
} else {
d.width += 4;
d.height += 2;
}
d.height += 2;
return d;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -74,7 +74,7 @@ import sun.java2d.SunCompositeContext;
*
* <blockquote>
* <table summary="layout">
* <tr><th align=left>Factor&nbsp;&nbsp;<th align=left>Definition
* <tr><th style="text-align:left">Factor&nbsp;&nbsp;<th style="text-align:left">Definition
* <tr><td><em>A<sub>s</sub></em><td>the alpha component of the source pixel
* <tr><td><em>C<sub>s</sub></em><td>a color component of the source pixel in premultiplied form
* <tr><td><em>A<sub>d</sub></em><td>the alpha component of the destination pixel
@ -114,7 +114,7 @@ import sun.java2d.SunCompositeContext;
*
* <blockquote>
* <table summary="layout">
* <tr><th align=left>Factor&nbsp;&nbsp;<th align=left>Definition
* <tr><th style="text-align:left">Factor&nbsp;&nbsp;<th style="text-align:left">Definition
* <tr><td><em>C<sub>sr</sub></em> <td>one of the raw color components of the source pixel
* <tr><td><em>C<sub>dr</sub></em> <td>one of the raw color components of the destination pixel
* <tr><td><em>A<sub>ac</sub></em> <td>the "extra" alpha component from the AlphaComposite instance
@ -205,7 +205,7 @@ import sun.java2d.SunCompositeContext;
* appropriate conversions are performed before and after the compositing
* operation.
*
* <h3><a name="caveats">Implementation Caveats</a></h3>
* <h3><a id="caveats">Implementation Caveats</a></h3>
*
* <ul>
* <li>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -78,7 +78,7 @@ import java.util.Map;
* <p>
* When creating a {@code Graphics2D} object, the
* {@code GraphicsConfiguration}
* specifies the <a name="deftransform">default transform</a> for
* specifies the <a id="deftransform">default transform</a> for
* the target of the {@code Graphics2D} (a
* {@link Component} or {@link Image}). This default transform maps the
* user space coordinate system to screen and printer device coordinates
@ -129,7 +129,7 @@ import java.util.Map;
* of their particular rendering processes are:
* <ol>
* <li>
* <b><a name="rendershape">{@code Shape} operations</a></b>
* <b><a id="rendershape">{@code Shape} operations</a></b>
* <ol>
* <li>
* If the operation is a {@code draw(Shape)} operation, then
@ -160,7 +160,7 @@ import java.util.Map;
* colors to render in device space.
* </ol>
* <li>
* <b><a name=rendertext>Text operations</a></b>
* <b><a id=rendertext>Text operations</a></b>
* <ol>
* <li>
* The following steps are used to determine the set of glyphs required
@ -201,7 +201,7 @@ import java.util.Map;
* the colors to render in device space.
* </ol>
* <li>
* <b><a name= renderingimage>{@code Image} Operations</a></b>
* <b><a id= renderingimage>{@code Image} Operations</a></b>
* <ol>
* <li>
* The region of interest is defined by the bounding box of the source

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 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
@ -122,7 +122,7 @@ import java.util.Arrays;
* are not. Baseline relative values are calculated relative to the
* baseline. Valid values are:
*
* <center><table BORDER=0 WIDTH=800
* <center><table BORDER=0 style="width:800"
* SUMMARY="absolute, relative and baseline values as described above">
* <tr>
* <th><P style="text-align:left">Absolute Values</th>
@ -198,7 +198,7 @@ import java.util.Arrays;
* The following figure shows a baseline layout and includes a
* component that spans rows:
* <center><table summary="Baseline Layout">
* <tr ALIGN=CENTER>
* <tr style="text-align:center">
* <td>
* <img src="doc-files/GridBagLayout-baseline.png"
* alt="The following text describes this graphic (Figure 1)." style="float:center">
@ -252,15 +252,15 @@ import java.util.Arrays;
* left-to-right container and Figure 3 shows the layout for a horizontal,
* right-to-left container.
*
* <center><table WIDTH=600 summary="layout">
* <tr ALIGN=CENTER>
* <center><table style="width:600" summary="layout">
* <tr style="text-align:center">
* <td>
* <img src="doc-files/GridBagLayout-1.gif" alt="The preceding text describes this graphic (Figure 1)." style="float:center; margin: 7px 10px;">
* </td>
* <td>
* <img src="doc-files/GridBagLayout-2.gif" alt="The preceding text describes this graphic (Figure 2)." style="float:center; margin: 7px 10px;">
* </td>
* <tr ALIGN=CENTER>
* <tr style="text-align:center">
* <td>Figure 2: Horizontal, Left-to-Right</td>
* <td>Figure 3: Horizontal, Right-to-Left</td>
* </tr>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 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
@ -55,20 +55,20 @@ package java.awt;
* If the container's {@code ComponentOrientation} property is horizontal
* and right-to-left, the example produces the output shown in Figure 2.
*
* <table style="float:center" WIDTH=600 summary="layout">
* <tr ALIGN=CENTER>
* <table style="float:center;width:600" summary="layout">
* <tr style="text-align:center">
* <td><img SRC="doc-files/GridLayout-1.gif"
* alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 1 then 2.
* Row 2 shows buttons 3 then 4. Row 3 shows buttons 5 then 6.">
* </td>
*
* <td ALIGN=CENTER><img SRC="doc-files/GridLayout-2.gif"
* alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 2 then 1.
* <td style="text-align:center"><img SRC="doc-files/GridLayout-2.gif"
* alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 2 then 1.
* Row 2 shows buttons 4 then 3. Row 3 shows buttons 6 then 5.">
* </td>
* </tr>
*
* <tr ALIGN=CENTER>
* <tr style="text-align:center">
* <td>Figure 1: Horizontal, Left-to-Right</td>
*
* <td>Figure 2: Horizontal, Right-to-Left</td>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 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
@ -91,10 +91,9 @@ import java.beans.ConstructorProperties;
* <p>
* This image demonstrates the example code above for each
* of the three cycle methods:
* <center>
* <p style="text-align:center">
* <img src = "doc-files/LinearGradientPaint.png"
* alt="image showing the output of the example code">
* </center>
*
* @see java.awt.Paint
* @see java.awt.Graphics2D#setPaint

View File

@ -46,7 +46,7 @@ import sun.awt.AWTAccessor;
* the menu bar with a {@code Frame} object, call the
* frame's {@code setMenuBar} method.
* <p>
* <A NAME="mbexample"></A><!-- target for cross references -->
* <a id="mbexample"></a><!-- target for cross references -->
* This is what a menu bar might look like:
* <p>
* <img src="doc-files/MenuBar-1.gif"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 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
@ -79,18 +79,18 @@ import java.beans.ConstructorProperties;
* The gradient color proportions are equal for any particular line drawn
* from the focus point. The following figure shows that the distance AB
* is equal to the distance BC, and the distance AD is equal to the distance DE.
* <center>
* <p style="text-align:center">
* <img src = "doc-files/RadialGradientPaint-3.png" alt="image showing the
* distance AB=BC, and AD=DE">
* </center>
* <p>
* If the gradient and graphics rendering transforms are uniformly scaled and
* the user sets the focus so that it coincides with the center of the circle,
* the gradient color proportions are equal for any line drawn from the center.
* The following figure shows the distances AB, BC, AD, and DE. They are all equal.
* <center>
* <p style="text-align:center">
* <img src = "doc-files/RadialGradientPaint-4.png" alt="image showing the
* distance of AB, BC, AD, and DE are all equal">
* </center>
* <p>
* Note that some minor variations in distances may occur due to sampling at
* the granularity of a pixel.
* If no cycle method is specified, {@code NO_CYCLE} will be chosen by
@ -116,11 +116,9 @@ import java.beans.ConstructorProperties;
* <p>
* This image demonstrates the example code above, with default
* (centered) focus for each of the three cycle methods:
* <center>
* <p style="text-align:center">
* <img src = "doc-files/RadialGradientPaint-1.png" alt="image showing the
* output of the sameple code">
* </center>
*
* <p>
* It is also possible to specify a non-centered focus point, as
* in the following code:
@ -139,10 +137,9 @@ import java.beans.ConstructorProperties;
* <p>
* This image demonstrates the previous example code, with non-centered
* focus for each of the three cycle methods:
* <center>
* <p style="text-align:center">
* <img src = "doc-files/RadialGradientPaint-2.png" alt="image showing the
* output of the sample code">
* </center>
*
* @see java.awt.Paint
* @see java.awt.Graphics2D#setPaint

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 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
@ -39,7 +39,7 @@ import java.beans.Transient;
* that create a {@code Rectangle}, and the methods that can modify
* one, do not prevent setting a negative value for width or height.
* <p>
* <a name="Empty">
* <a id="Empty">
* A {@code Rectangle} whose width or height is exactly zero has location
* along those axes with zero dimension, but is otherwise considered empty.</a>
* The {@link #isEmpty} method will return true for such a {@code Rectangle}.
@ -49,7 +49,7 @@ import java.beans.Transient;
* will include the location of the {@code Rectangle} on that axis in the
* result as if the {@link #add(Point)} method were being called.
* <p>
* <a name="NonExistent">
* <a id="NonExistent">
* A {@code Rectangle} whose width or height is negative has neither
* location nor dimension along those axes with negative dimensions.
* Such a {@code Rectangle} is treated as non-existent along those axes.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -43,7 +43,7 @@ import java.awt.geom.Rectangle2D;
* object that describes the trajectory path of the {@code Shape}
* outline.
* <p>
* <a name="def_insideness"><b>Definition of insideness:</b></a>
* <a id="def_insideness"><b>Definition of insideness:</b></a>
* A point is considered to lie inside a
* {@code Shape} if and only if:
* <ul>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -65,7 +65,7 @@ import sun.awt.ComponentFactory;
* itself between the platform and the
* listeners provided by the initiator of the drag operation.
* <p>
* <a name="defaultCursor"></a>
* <a id="defaultCursor"></a>
* By default, {@code DragSourceContext} sets the cursor as appropriate
* for the current state of the drag and drop operation. For example, if
* the user has chosen {@linkplain DnDConstants#ACTION_MOVE the move action},

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -96,14 +96,14 @@ import jdk.internal.misc.SharedSecrets;
* </UL>
*
* <h4>Summary of attributes</h4>
* <table style="float:center" border="0" cellspacing="0" cellpadding="2" width="95%"
* <table style="float:center;width:95%" border="0" cellspacing="0" cellpadding="2"
* summary="Key, value type, principal constants, and default value
* behavior of all TextAttributes">
* <tr style="background-color:#ccccff">
* <th valign="TOP" align="CENTER">Key</th>
* <th valign="TOP" align="CENTER">Value Type</th>
* <th valign="TOP" align="CENTER">Principal Constants</th>
* <th valign="TOP" align="CENTER">Default Value</th>
* <th valign="TOP" style="text-align:center">Key</th>
* <th valign="TOP" style="text-align:center">Value Type</th>
* <th valign="TOP" style="text-align:center">Principal Constants</th>
* <th valign="TOP" style="text-align:center">Default Value</th>
* </tr>
* <tr>
* <td valign="TOP">{@link #FAMILY}</td>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -46,7 +46,7 @@ import java.beans.ConstructorProperties;
* [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* </pre>
* <h3><a name="quadrantapproximation">Handling 90-Degree Rotations</a></h3>
* <h3><a id="quadrantapproximation">Handling 90-Degree Rotations</a></h3>
* <p>
* In some variations of the {@code rotate} methods in the
* {@code AffineTransform} class, a double-precision argument

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -33,11 +33,11 @@ import java.io.Serializable;
* start angle, angular extent (length of the arc), and a closure type
* ({@code OPEN}, {@code CHORD}, or {@code PIE}).
* <p>
* <a name="inscribes">
* <a id="inscribes">
* The arc is a partial section of a full ellipse which
* inscribes the framing rectangle of its parent</a> {@link RectangularShape}.
*
* <a name="angles">
* <a id="angles">
* The angles are specified relative to the non-square
* framing rectangle such that 45 degrees always falls on the line from
* the center of the ellipse to the upper right corner of the framing

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -618,7 +618,7 @@ public abstract class Line2D implements Shape, Cloneable {
* specified line segment
* @param y2 the Y coordinate of the end point of the
* specified line segment
* @return {@code <true>} if this line segment and the specified line segment
* @return {@code true} if this line segment and the specified line segment
* intersect each other; {@code false} otherwise.
* @since 1.2
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 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
@ -846,7 +846,7 @@ public abstract class Path2D implements Shape, Cloneable {
* path.
*
* @serialData
* <a name="Path2DSerialData"><!-- --></a>
* <a id="Path2DSerialData"><!-- --></a>
* <ol>
* <li>The default serializable fields.
* There are no default serializable fields as of 1.6.
@ -1605,7 +1605,7 @@ public abstract class Path2D implements Shape, Cloneable {
* path.
*
* @serialData
* <a name="Path2DSerialData"><!-- --></a>
* <a id="Path2DSerialData"><!-- --></a>
* <ol>
* <li>The default serializable fields.
* There are no default serializable fields as of 1.6.

View File

@ -33,7 +33,7 @@
* languages and the use of entirely different input mechanisms, such as
* handwriting recognition.
*
* <h2><a name="Packaging"></a>Packaging Input Methods</h2>
* <h2><a id="Packaging"></a>Packaging Input Methods</h2>
* Input methods can be made available by adding them to the application's class
* path. The main JAR file of an input method must contain the file:
* <pre>
@ -61,14 +61,14 @@
* that loading of the class implementing {@code InputMethod} can be deferred
* until actually needed.
*
* <h2><a name="Loading"></a>Loading Input Methods</h2>
* <h2><a id="Loading"></a>Loading Input Methods</h2>
* The input method framework will usually defer loading of input method
* classes until they are absolutely needed. It loads only the
* {@code InputMethodDescriptor} implementations during AWT initialization. It
* loads an {@code InputMethod} implementation when the input method has been
* selected.
*
* <h2><a name="PeeredComponents"></a>Java Input Methods and Peered Text
* <h2><a id="PeeredComponents"></a>Java Input Methods and Peered Text
* Components</h2>
* The Java input method framework intends to support all combinations of input
* methods (host input methods and Java input methods) and components (peered

View File

@ -29,7 +29,8 @@ import java.awt.Image;
/**
* This class provides default implementations of several {@code Image} methods
* for classes that want to implement the {@MultiResolutionImage} interface.
* for classes that want to implement the {@code MultiResolutionImage}
* interface.
*
* For example,
* <pre> {@code

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -42,7 +42,7 @@ import static sun.java2d.StateTrackable.State.*;
* Values stored in the byte array(s) of this {@code DataBuffer} are treated as
* unsigned values.
* <p>
* <a name="optimizations">
* <a id="optimizations">
* Note that some implementations may function more efficiently
* if they can maintain control over how the data for an image is
* stored.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -31,7 +31,7 @@ import static sun.java2d.StateTrackable.State.*;
* This class extends {@code DataBuffer} and stores data internally
* in {@code double} form.
* <p>
* <a name="optimizations">
* <a id="optimizations">
* Note that some implementations may function more efficiently
* if they can maintain control over how the data for an image is
* stored.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -31,7 +31,7 @@ import static sun.java2d.StateTrackable.State.*;
* This class extends {@code DataBuffer} and stores data internally
* in {@code float} form.
* <p>
* <a name="optimizations">
* <a id="optimizations">
* Note that some implementations may function more efficiently
* if they can maintain control over how the data for an image is
* stored.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -41,7 +41,7 @@ import static sun.java2d.StateTrackable.State.*;
* This class extends {@code DataBuffer} and stores data internally
* as integers.
* <p>
* <a name="optimizations">
* <a id="optimizations">
* Note that some implementations may function more efficiently
* if they can maintain control over how the data for an image is
* stored.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -40,7 +40,7 @@ import static sun.java2d.StateTrackable.State.*;
/**
* This class extends {@code DataBuffer} and stores data internally as shorts.
* <p>
* <a name="optimizations">
* <a id="optimizations">
* Note that some implementations may function more efficiently
* if they can maintain control over how the data for an image is
* stored.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -42,7 +42,7 @@ import static sun.java2d.StateTrackable.State.*;
* shorts. Values stored in the short array(s) of this {@code DataBuffer}
* are treated as unsigned values.
* <p>
* <a name="optimizations">
* <a id="optimizations">
* Note that some implementations may function more efficiently
* if they can maintain control over how the data for an image is
* stored.

View File

@ -55,7 +55,7 @@ import java.util.Arrays;
* {@code IndexColorModel} objects are never pre-multiplied with
* the alpha components.
* <p>
* <a name="transparency">
* <a id="transparency">
* The transparency of an {@code IndexColorModel} object is
* determined by examining the alpha components of the colors in the
* colormap and choosing the most specific value after considering
@ -86,7 +86,7 @@ import java.util.Arrays;
* and {@code getNumComponents} returns 4.
*
* <p>
* <a name="index_values">
* <a id="index_values">
* The values used to index into the colormap are taken from the least
* significant <em>n</em> bits of pixel representations where
* <em>n</em> is based on the pixel size specified in the constructor.

View File

@ -35,10 +35,10 @@
* components can fire. See AWTEvent for a description of the AWT event model.
* <p>
* A container is a component that can contain components and other containers.
* A con tainer can also have a layout manager that controls the visual
* placement of components in the container. The AWT package contains several
* layout manager classes and an interface for building your own layout manager.
* See Container and LayoutManager for more information.
* A container can also have a layout manager that controls the visual placement
* of components in the container. The AWT package contains several layout
* manager classes and an interface for building your own layout manager. See
* Container and LayoutManager for more information.
* <p>
* Each {@code Component} object is limited in its maximum size and its location
* because the values are stored as an integer. Also, a platform may further
@ -54,6 +54,8 @@
* <ul>
* <li><a href="doc-files/FocusSpec.html">The AWT Focus Subsystem</a>
* <li><a href="doc-files/Modality.html">The AWT Modality</a>
* <li><a href="{@docRoot}/../specs/AWT_Native_Interface.html">
* The Java AWT Native Interface (JAWT)</a>
* </ul>
*
* @since 1.0

View File

@ -37,7 +37,7 @@
* interfaces, and 6 Java programming language classes. These are described
* below.
*
* <h3><a name="Accessible"></a><a href="Accessible.html">Interface
* <h3><a id="Accessible"></a><a href="Accessible.html">Interface
* Accessible</a></h3>
* <a href="Accessible.html">Interface Accessible</a> is the main interface of
* the Java Accessibility API. All components that support the Java
@ -48,7 +48,7 @@
* object that is part of the user interface of a Java application, if that
* program is to be compatible with assistive technologies.
*
* <h3><a name="AccessibleContext"></a><a href="AccessibleContext.html">Class
* <h3><a id="AccessibleContext"></a><a href="AccessibleContext.html">Class
* AccessibleContext</a></h3>
* <a href="AccessibleContext.html">AccessibleContext</a> represents the minimum
* information all accessible objects return and is obtained by calling the
@ -108,7 +108,7 @@
* called on an AccessibleContext.</li>
* </ul>
*
* <h3><a name="AccessibleRole"></a><a href="AccessibleRole.html">Class
* <h3><a id="AccessibleRole"></a><a href="AccessibleRole.html">Class
* AccessibleRole</a></h3>
* This class encapsulates the Accessible object's role in the user interface
* and is obtained by calling the {@code getAccessibleRole} method on an
@ -123,7 +123,7 @@
* programmer-defined roles can be added in the future without needing to modify
* the base class.
*
* <h3><a name="AccessibleState"></a><a href="AccessibleState.html">Class
* <h3><a id="AccessibleState"></a><a href="AccessibleState.html">Class
* AccessibleState</a></h3>
* This class encapsulates a particular state of the Accessible object.
* Accessible states include things like "Armed", "Busy", "Checked", "Focused",
@ -142,7 +142,7 @@
* additional, programmer-defined roles can be added in the future without
* needing to modify the base class.
*
* <h3><a name="AccessibleStateSet"></a><a href="AccessibleStateSet.html">Class
* <h3><a id="AccessibleStateSet"></a><a href="AccessibleStateSet.html">Class
* AccessibleStateSet</a></h3>
* This class encapsulates a collection of states of the Accessible object and
* is obtained by calling the {@code getAccessibleStateSet} method on an
@ -152,7 +152,7 @@
* class provide for retrieving the individual
* <a href="#AccessibleState">AccessibleStates</a> on the state set.
*
* <h3><a name="AccessibleBundle"></a><a href="AccessibleBundle.html">Class
* <h3><a id="AccessibleBundle"></a><a href="AccessibleBundle.html">Class
* AccessibleBundle</a></h3>
* This class is used to maintain a strongly typed enumeration. It is the super
* class of both the <a href="#AccessibleRole">AccessibleRole</a> and
@ -161,7 +161,7 @@
* <a href="#AccessibleRole">AccessibleRole</a> and
* <a href="#AccessibleState">AccessibleState</a> classes.
*
* <h3><a name="AccessibleAction"></a><a href="AccessibleAction.html">Interface
* <h3><a id="AccessibleAction"></a><a href="AccessibleAction.html">Interface
* AccessibleAction</a></h3>
* The <a href="AccessibleAction.html">AccessibleAction</a> interface should be
* supported by any object that can perform one or more actions. This interface
@ -177,7 +177,7 @@
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
* not null, the object supports this interface.
*
* <h3> <a name="AccessibleComponent"></a><a href="AccessibleComponent.html">
* <h3> <a id="AccessibleComponent"></a><a href="AccessibleComponent.html">
* Interface AccessibleComponent</a></h3>
* The <a href="AccessibleComponent.html">AccessibleComponent</a> interface
* should be supported by any object that is rendered on the screen. This
@ -190,7 +190,7 @@
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
* not null, the object supports this interface.
*
* <h3><a name="AccessibleSelection"></a><a href="AccessibleSelection.html">
* <h3><a id="AccessibleSelection"></a><a href="AccessibleSelection.html">
* Interface AccessibleSelection</a></h3>
* The <a href="AccessibleSelection.html">AccessibleSelection</a> interface
* provides the standard mechanism for an assistive technology to determine what
@ -206,7 +206,7 @@
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
* not null, the object supports this interface.
*
* <h3><a name="AccessibleText"></a><a href="AccessibleText.html">Interface
* <h3><a id="AccessibleText"></a><a href="AccessibleText.html">Interface
* AccessibleText</a></h3>
* Interface <a href="AccessibleText.html">AccessibleText</a> is the contract
* for making rich, editable text Accessible. Not all text displayed on the
@ -230,7 +230,7 @@
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
* not null, the object supports this interface.
*
* <h3><a name="AccessibleHypertext"></a> <a href="AccessibleHypertext.html">
* <h3><a id="AccessibleHypertext"></a> <a href="AccessibleHypertext.html">
* Interface AccessibleHypertext</a></h3>
* The <a href="AccessibleHypertext.html">AccessibleHypertext</a> interface
* should be supported by any object that presents hypertext information on the
@ -246,7 +246,7 @@
* class which extends AccessibleHypertext, then that object supports
* AccessibleHypertext.
*
* <h3><a name="AccessibleHyperlink"></a><a href="AccessibleHyperlink.html">
* <h3><a id="AccessibleHyperlink"></a><a href="AccessibleHyperlink.html">
* Interface AccessibleHyperlink</a></h3>
* An object that is a hyperlink should support the
* <a href="AccessibleHyperlink.html">AccessibleHyperlink</a> interface.&nbsp;
@ -254,7 +254,7 @@
* getLink method on an <a href="#AccessibleHypertext">AccessibleHypertext</a>
* object.
*
* <h3><a name="AccessibleValue"></a><a href="AccessibleValue.html">Interface
* <h3><a id="AccessibleValue"></a><a href="AccessibleValue.html">Interface
* AccessibleValue</a></h3>
* The <a href="AccessibleValue.html">AccessibleValue</a> interface should be
* supported by any object that supports a numerical value (e.g., a scroll bar).

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -63,8 +63,8 @@ import com.sun.imageio.plugins.tiff.TIFFImageMetadata;
* <p>A {@code TIFFDirectory} is aware of the tag numbers in the
* group of {@link TIFFTagSet}s associated with it. When
* a {@code TIFFDirectory} is created from a native image metadata
* object, these tag sets are derived from the <tt>tagSets</tt> attribute
* of the <tt>TIFFIFD</tt> node.</p>
* object, these tag sets are derived from the {@code tagSets} attribute
* of the {@code TIFFIFD} node.</p>
*
* <p>A {@code TIFFDirectory} might also have a parent {@link TIFFTag}.
* This will occur if the directory represents an IFD other than the root
@ -73,8 +73,8 @@ import com.sun.imageio.plugins.tiff.TIFFImageMetadata;
* {@link TIFFTag#isIFDPointer} method of this parent {@code TIFFTag}
* must return {@code true}. When a {@code TIFFDirectory} is
* created from a native image metadata object, the parent tag set is set
* from the <tt>parentTagName</tt> attribute of the corresponding
* <tt>TIFFIFD</tt> node. Note that a {@code TIFFDirectory} instance
* from the {@code parentTagName} attribute of the corresponding
* {@code TIFFIFD} node. Note that a {@code TIFFDirectory} instance
* which has a non-{@code null} parent tag will be contained in the
* data field of a {@code TIFFField} instance which has a tag field
* equal to the contained directory's parent tag.</p>
@ -133,8 +133,8 @@ public class TIFFDirectory implements Cloneable {
* an image metadata object. The supplied object must support an image
* metadata format supported by the TIFF {@link javax.imageio.ImageWriter}
* plug-in. This will usually be either the TIFF native image metadata
* format <tt>javax_imageio_tiff_image_1.0</tt> or the Java
* Image I/O standard metadata format <tt>javax_imageio_1.0</tt>.
* format {@code javax_imageio_tiff_image_1.0} or the Java
* Image I/O standard metadata format {@code javax_imageio_1.0}.
*
* @param tiffImageMetadata A metadata object which supports a compatible
* image metadata format.

View File

@ -62,7 +62,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>BYTE</tt>
* {@code BYTE}
* </td>
* <td>
* {@link TIFFTag#TIFF_BYTE}
@ -77,7 +77,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>ASCII</tt>
* {@code ASCII}
* </td>
* <td>
* {@link TIFFTag#TIFF_ASCII}
@ -92,7 +92,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>SHORT</tt>
* {@code SHORT}
* </td>
* <td>
* {@link TIFFTag#TIFF_SHORT}
@ -107,7 +107,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>LONG</tt>
* {@code LONG}
* </td>
* <td>
* {@link TIFFTag#TIFF_LONG}
@ -122,7 +122,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>RATIONAL</tt>
* {@code RATIONAL}
* </td>
* <td>
* {@link TIFFTag#TIFF_RATIONAL}
@ -137,7 +137,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>SBYTE</tt>
* {@code SBYTE}
* </td>
* <td>
* {@link TIFFTag#TIFF_SBYTE}
@ -152,7 +152,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>UNDEFINED</tt>
* {@code UNDEFINED}
* </td>
* <td>
* {@link TIFFTag#TIFF_UNDEFINED}
@ -167,7 +167,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>SSHORT</tt>
* {@code SSHORT}
* </td>
* <td>
* {@link TIFFTag#TIFF_SSHORT}
@ -182,7 +182,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>SLONG</tt>
* {@code SLONG}
* </td>
* <td>
* {@link TIFFTag#TIFF_SLONG}
@ -197,7 +197,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>SRATIONAL</tt>
* {@code SRATIONAL}
* </td>
* <td>
* {@link TIFFTag#TIFF_SRATIONAL}
@ -212,7 +212,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>FLOAT</tt>
* {@code FLOAT}
* </td>
* <td>
* {@link TIFFTag#TIFF_FLOAT}
@ -227,7 +227,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>DOUBLE</tt>
* {@code DOUBLE}
* </td>
* <td>
* {@link TIFFTag#TIFF_DOUBLE}
@ -242,7 +242,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD;
*
* <tr>
* <td>
* <tt>IFD</tt>
* {@code IFD}
* </td>
* <td>
* {@link TIFFTag#TIFF_IFD_POINTER}
@ -941,14 +941,14 @@ public final class TIFFField implements Cloneable {
/**
* Returns the {@code TIFFField} as a node named either
* <tt>"TIFFField"</tt> or <tt>"TIFFIFD"</tt> as described in the
* {@code "TIFFField"} or {@code "TIFFIFD"} as described in the
* TIFF native image metadata specification. The node will be named
* <tt>"TIFFIFD"</tt> if and only if {@link #hasDirectory()} returns
* {@code "TIFFIFD"} if and only if {@link #hasDirectory()} returns
* {@code true} and the field's type is either {@link TIFFTag#TIFF_LONG}
* or {@link TIFFTag#TIFF_IFD_POINTER}.
*
* @return a {@code Node} named <tt>"TIFFField"</tt> or
* <tt>"TIFFIFD"</tt>.
* @return a {@code Node} named {@code "TIFFField"} or
* {@code "TIFFIFD"}.
*/
public Node getAsNativeNode() {
return new TIFFFieldNode(this);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -50,7 +50,6 @@ import java.util.Vector;
* <LI>
* Since not all Java profiles include the AWT, the Jini Print Service should
* not depend on an AWT class.
* <P>
* <LI>
* The implementation of class java.awt.datatransfer.MimeType does not
* guarantee
@ -76,7 +75,6 @@ import java.util.Vector;
* <LI> Quoting backslash characters inside parameter values are removed.
* <LI> The parameters are arranged in ascending order of parameter name.
* </UL>
* <P>
*
* @author Alan Kaminsky
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -40,7 +40,7 @@ import javax.print.attribute.PrintJobAttribute;
* for purposes of finishing.
* <P>
* Standard Finishings values are:
* <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
* <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 style="width:100%" SUMMARY="layout">
* <TR>
* <TD STYLE="WIDTH:10%">
* &nbsp;
@ -76,7 +76,7 @@ import javax.print.attribute.PrintJobAttribute;
* <P>
* The following Finishings values are more specific; they indicate a
* corner or an edge as if the document were a portrait document:
* <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
* <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 style="width:100%" SUMMARY="layout">
* <TR>
* <TD STYLE="WIDTH:10%">
* &nbsp;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -70,7 +70,7 @@ import javax.print.attribute.PrintJobAttribute;
* The standard MultipleDocumentHandling values are:
* <UL>
* <LI>
* <a NAME="sdfi"></a>{@link #SINGLE_DOCUMENT
* <a id="sdfi"></a>{@link #SINGLE_DOCUMENT
* <B>SINGLE_DOCUMENT</B>}. If a print job has multiple
* documents -- say, the document data is called {@code a} and
* {@code b} -- then the result of processing all the document data
@ -85,7 +85,7 @@ import javax.print.attribute.PrintJobAttribute;
* each copy ({@code a(*),b(*)}) to start on a new media sheet.
*
* <LI>
* <a NAME="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
* <a id="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
* <B>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</B>}. If a print job
* has multiple documents -- say, the document data is called {@code a} and
* {@code b} -- then the result of processing the data in each document
@ -98,7 +98,7 @@ import javax.print.attribute.PrintJobAttribute;
* {@code a(*),a(*),...,b(*),b(*)...}.
*
* <LI>
* <a NAME="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
* <a id="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
* <B>SEPARATE_DOCUMENTS_COLLATED_COPIES</B>}. If a print job
* has multiple documents -- say, the document data is called {@code a} and
* {@code b} -- then the result of processing the data in each document
@ -111,7 +111,7 @@ import javax.print.attribute.PrintJobAttribute;
* {@code a(*),b(*),a(*),b(*),...}.
*
* <LI>
* <a NAME="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
* <a id="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
* <B>SINGLE_DOCUMENT_NEW_SHEET</B>}. Same as SINGLE_DOCUMENT,
* except that the printer must ensure that the first impression of each
* document instance in the job is placed on a new media sheet. This value

View File

@ -59,7 +59,7 @@ public class MetaMessage extends MidiMessage {
*
* @see MidiMessage#getStatus
*/
public static final int META = 0xFF; // 255
public static final int META = 0xFF; // 255
/**
* The length of the actual message in the data array. This is used to

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -47,15 +47,15 @@ package javax.sound.midi;
* {@code MidiMessage} includes methods to get, but not set, these values.
* Setting them is a subclass responsibility.
* <p>
* <a name="integersVsBytes"></a> The MIDI standard expresses MIDI data in
* <a id="integersVsBytes"></a> The MIDI standard expresses MIDI data in
* bytes. However, because Java<sup>TM</sup> uses signed bytes, the Java Sound
* API uses integers instead of bytes when expressing MIDI data. For example,
* the {@link #getStatus()} method of {@code MidiMessage} returns MIDI status
* bytes as integers. If you are processing MIDI data that originated outside
* Java Sound and now is encoded as signed bytes, the bytes can be
* converted to integers using this conversion:
*
* <center>{@code int i = (int)(byte & 0xFF)}</center>
* <p style="text-align:center">
* {@code int i = (int)(byte & 0xFF)}
* <p>
* If you simply need to pass a known MIDI byte value as a method parameter, it
* can be expressed directly as an integer, using (for example) decimal or

View File

@ -58,7 +58,7 @@ public class Sequence {
*
* @see #Sequence(float, int)
*/
public static final float PPQ = 0.0f;
public static final float PPQ = 0.0f;
/**
* The SMPTE-based timing type with 24 frames per second (resolution is
@ -66,7 +66,7 @@ public class Sequence {
*
* @see #Sequence(float, int)
*/
public static final float SMPTE_24 = 24.0f;
public static final float SMPTE_24 = 24.0f;
/**
* The SMPTE-based timing type with 25 frames per second (resolution is
@ -74,7 +74,7 @@ public class Sequence {
*
* @see #Sequence(float, int)
*/
public static final float SMPTE_25 = 25.0f;
public static final float SMPTE_25 = 25.0f;
/**
* The SMPTE-based timing type with 29.97 frames per second (resolution is
@ -82,7 +82,7 @@ public class Sequence {
*
* @see #Sequence(float, int)
*/
public static final float SMPTE_30DROP = 29.97f;
public static final float SMPTE_30DROP = 29.97f;
/**
* The SMPTE-based timing type with 30 frames per second (resolution is
@ -90,7 +90,7 @@ public class Sequence {
*
* @see #Sequence(float, int)
*/
public static final float SMPTE_30 = 30.0f;
public static final float SMPTE_30 = 30.0f;
// Variables

View File

@ -733,7 +733,7 @@ public interface Sequencer extends MidiDevice {
* information from its internal clock. This is not a legal slave sync
* mode.
*/
public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock");
public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock");
/**
* A master or slave synchronization mode that specifies the use of MIDI
@ -745,7 +745,7 @@ public interface Sequencer extends MidiDevice {
* receiver. MIDI clock messages are sent at a rate of 24 per quarter
* note.
*/
public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync");
public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync");
/**
* A master or slave synchronization mode that specifies the use of MIDI
@ -756,13 +756,13 @@ public interface Sequencer extends MidiDevice {
* sequencer sends MIDI Time Code messages to its receiver. (See the
* MIDI 1.0 Detailed Specification for a description of MIDI Time Code.)
*/
public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code");
public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code");
/**
* A slave synchronization mode indicating that no timing information
* should be sent to the receiver. This is not a legal master sync mode.
*/
public static final SyncMode NO_SYNC = new SyncMode("No Timing");
public static final SyncMode NO_SYNC = new SyncMode("No Timing");
}
}

View File

@ -61,35 +61,35 @@ public class ShortMessage extends MidiMessage {
*
* @see MidiMessage#getStatus
*/
public static final int MIDI_TIME_CODE = 0xF1; // 241
public static final int MIDI_TIME_CODE = 0xF1; // 241
/**
* Status byte for Song Position Pointer message (0xF2, or 242).
*
* @see MidiMessage#getStatus
*/
public static final int SONG_POSITION_POINTER = 0xF2; // 242
public static final int SONG_POSITION_POINTER = 0xF2; // 242
/**
* Status byte for MIDI Song Select message (0xF3, or 243).
*
* @see MidiMessage#getStatus
*/
public static final int SONG_SELECT = 0xF3; // 243
public static final int SONG_SELECT = 0xF3; // 243
/**
* Status byte for Tune Request message (0xF6, or 246).
*
* @see MidiMessage#getStatus
*/
public static final int TUNE_REQUEST = 0xF6; // 246
public static final int TUNE_REQUEST = 0xF6; // 246
/**
* Status byte for End of System Exclusive message (0xF7, or 247).
*
* @see MidiMessage#getStatus
*/
public static final int END_OF_EXCLUSIVE = 0xF7; // 247
public static final int END_OF_EXCLUSIVE = 0xF7; // 247
// System real-time messages
@ -98,80 +98,80 @@ public class ShortMessage extends MidiMessage {
*
* @see MidiMessage#getStatus
*/
public static final int TIMING_CLOCK = 0xF8; // 248
public static final int TIMING_CLOCK = 0xF8; // 248
/**
* Status byte for Start message (0xFA, or 250).
*
* @see MidiMessage#getStatus
*/
public static final int START = 0xFA; // 250
public static final int START = 0xFA; // 250
/**
* Status byte for Continue message (0xFB, or 251).
*
* @see MidiMessage#getStatus
*/
public static final int CONTINUE = 0xFB; // 251
public static final int CONTINUE = 0xFB; // 251
/**
* Status byte for Stop message (0xFC, or 252).
*
* @see MidiMessage#getStatus
*/
public static final int STOP = 0xFC; //252
public static final int STOP = 0xFC; //252
/**
* Status byte for Active Sensing message (0xFE, or 254).
*
* @see MidiMessage#getStatus
*/
public static final int ACTIVE_SENSING = 0xFE; // 254
public static final int ACTIVE_SENSING = 0xFE; // 254
/**
* Status byte for System Reset message (0xFF, or 255).
*
* @see MidiMessage#getStatus
*/
public static final int SYSTEM_RESET = 0xFF; // 255
public static final int SYSTEM_RESET = 0xFF; // 255
// Channel voice message upper nibble defines
/**
* Command value for Note Off message (0x80, or 128).
*/
public static final int NOTE_OFF = 0x80; // 128
public static final int NOTE_OFF = 0x80; // 128
/**
* Command value for Note On message (0x90, or 144).
*/
public static final int NOTE_ON = 0x90; // 144
public static final int NOTE_ON = 0x90; // 144
/**
* Command value for Polyphonic Key Pressure (Aftertouch) message (0xA0, or
* 160).
*/
public static final int POLY_PRESSURE = 0xA0; // 160
public static final int POLY_PRESSURE = 0xA0; // 160
/**
* Command value for Control Change message (0xB0, or 176).
*/
public static final int CONTROL_CHANGE = 0xB0; // 176
public static final int CONTROL_CHANGE = 0xB0; // 176
/**
* Command value for Program Change message (0xC0, or 192).
*/
public static final int PROGRAM_CHANGE = 0xC0; // 192
public static final int PROGRAM_CHANGE = 0xC0; // 192
/**
* Command value for Channel Pressure (Aftertouch) message (0xD0, or 208).
*/
public static final int CHANNEL_PRESSURE = 0xD0; // 208
public static final int CHANNEL_PRESSURE = 0xD0; // 208
/**
* Command value for Pitch Bend message (0xE0, or 224).
*/
public static final int PITCH_BEND = 0xE0; // 224
public static final int PITCH_BEND = 0xE0; // 224
/**
* Constructs a new {@code ShortMessage}. The contents of the new message

View File

@ -81,7 +81,7 @@ public class SysexMessage extends MidiMessage {
*
* @see MidiMessage#getStatus
*/
public static final int SYSTEM_EXCLUSIVE = 0xF0; // 240
public static final int SYSTEM_EXCLUSIVE = 0xF0; // 240
/**
* Status byte for Special System Exclusive message (0xF7, or 247), which is
@ -90,7 +90,7 @@ public class SysexMessage extends MidiMessage {
*
* @see MidiMessage#getStatus
*/
public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7; // 247
public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7; // 247
/**
* The data bytes for this system exclusive message. These are initialized

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -51,7 +51,7 @@ package javax.sound.midi;
* given type of {@code Synthesizer} always has a fixed number of voices, equal
* to the maximum number of simultaneous notes it is capable of sounding.
* <p>
* <a NAME="description_of_active"></a> If the voice is not currently processing
* <a id="description_of_active"></a> If the voice is not currently processing
* a MIDI note, it is considered inactive. A voice is inactive when it has been
* given no note-on commands, or when every note-on command received has been
* terminated by a corresponding note-off (or by an "all notes off" message).

View File

@ -141,14 +141,14 @@ public abstract class BooleanControl extends Control {
* Represents a control for the mute status of a line. Note that mute
* status does not affect gain.
*/
public static final Type MUTE = new Type("Mute");
public static final Type MUTE = new Type("Mute");
/**
* Represents a control for whether reverberation is applied to a line.
* Note that the status of this control not affect the reverberation
* settings for a line, but does affect whether these settings are used.
*/
public static final Type APPLY_REVERB = new Type("Apply Reverb");
public static final Type APPLY_REVERB = new Type("Apply Reverb");
/**
* Constructs a new boolean control type.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -361,8 +361,8 @@ public abstract class FloatControl extends Control {
* loudness is unaffected. Note that gain measures dB, not amplitude.
* The relationship between a gain in decibels and the corresponding
* linear amplitude multiplier is:
*
* <CENTER>{@code linearScalar = pow(10.0, gainDB/20.0)}</CENTER>
* <p style="text-align:center">
* {@code linearScalar = pow(10.0, gainDB/20.0)}
* <p>
* The {@code FloatControl} class has methods to impose a maximum and
* minimum allowable value for gain. However, because an audio signal
@ -386,7 +386,7 @@ public abstract class FloatControl extends Control {
* @see #REVERB_RETURN
* @see #VOLUME
*/
public static final Type MASTER_GAIN = new Type("Master Gain");
public static final Type MASTER_GAIN = new Type("Master Gain");
/**
* Represents a control for the auxiliary send gain on a line.
@ -394,7 +394,7 @@ public abstract class FloatControl extends Control {
* @see #MASTER_GAIN
* @see #AUX_RETURN
*/
public static final Type AUX_SEND = new Type("AUX Send");
public static final Type AUX_SEND = new Type("AUX Send");
/**
* Represents a control for the auxiliary return gain on a line.
@ -402,7 +402,7 @@ public abstract class FloatControl extends Control {
* @see #MASTER_GAIN
* @see #AUX_SEND
*/
public static final Type AUX_RETURN = new Type("AUX Return");
public static final Type AUX_RETURN = new Type("AUX Return");
/**
* Represents a control for the pre-reverb gain on a line. This control
@ -413,7 +413,7 @@ public abstract class FloatControl extends Control {
* @see #REVERB_RETURN
* @see EnumControl.Type#REVERB
*/
public static final Type REVERB_SEND = new Type("Reverb Send");
public static final Type REVERB_SEND = new Type("Reverb Send");
/**
* Represents a control for the post-reverb gain on a line. This control
@ -423,7 +423,7 @@ public abstract class FloatControl extends Control {
* @see #MASTER_GAIN
* @see #REVERB_SEND
*/
public static final Type REVERB_RETURN = new Type("Reverb Return");
public static final Type REVERB_RETURN = new Type("Reverb Return");
/**
* Represents a control for the volume on a line.
@ -431,7 +431,7 @@ public abstract class FloatControl extends Control {
/*
* $$kk: 08.30.99: ISSUE: what units? linear or dB?
*/
public static final Type VOLUME = new Type("Volume");
public static final Type VOLUME = new Type("Volume");
/**
* Represents a control for the relative pan (left-right positioning) of
@ -442,7 +442,7 @@ public abstract class FloatControl extends Control {
*
* @see #BALANCE
*/
public static final Type PAN = new Type("Pan");
public static final Type PAN = new Type("Pan");
/**
* Represents a control for the relative balance of a stereo signal
@ -452,7 +452,7 @@ public abstract class FloatControl extends Control {
*
* @see #PAN
*/
public static final Type BALANCE = new Type("Balance");
public static final Type BALANCE = new Type("Balance");
/**
* Represents a control that changes the sample rate of audio playback.
@ -470,7 +470,7 @@ public abstract class FloatControl extends Control {
* doubling the sample rate has the effect of doubling the frequencies
* in the sound's spectrum, which raises the pitch by an octave.
*/
public static final Type SAMPLE_RATE = new Type("Sample Rate");
public static final Type SAMPLE_RATE = new Type("Sample Rate");
/**
* Constructs a new float control type.

View File

@ -220,7 +220,7 @@ public class LineEvent extends EventObject {
* @see #CLOSE
* @see Line#open
*/
public static final Type OPEN = new Type("Open");
public static final Type OPEN = new Type("Open");
/**
* A type of event that is sent when a line closes, freeing the system
@ -229,7 +229,7 @@ public class LineEvent extends EventObject {
* @see #OPEN
* @see Line#close
*/
public static final Type CLOSE = new Type("Close");
public static final Type CLOSE = new Type("Close");
/**
* A type of event that is sent when a line begins to engage in active
@ -239,7 +239,7 @@ public class LineEvent extends EventObject {
* @see #STOP
* @see DataLine#start
*/
public static final Type START = new Type("Start");
public static final Type START = new Type("Start");
/**
* A type of event that is sent when a line ceases active input or
@ -249,7 +249,7 @@ public class LineEvent extends EventObject {
* @see #START
* @see DataLine#stop
*/
public static final Type STOP = new Type("Stop");
public static final Type STOP = new Type("Stop");
/**
* A type of event that is sent when a line ceases to engage in active

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -159,9 +159,9 @@ public interface SourceDataLine extends DataLine {
* <p>
* The number of bytes to write must represent an integral number of sample
* frames, such that:
* <br>
* <center>{@code [ bytes written ] % [frame size in bytes ] == 0}</center>
* <br>
* <p style="text-align:center">
* {@code [ bytes written ] % [frame size in bytes ] == 0}
* <p>
* The return value will always meet this requirement. A request to write a
* number of bytes representing a non-integral number of sample frames
* cannot be fulfilled and may result in an

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -149,9 +149,9 @@ public interface TargetDataLine extends DataLine {
* <p>
* The number of bytes to be read must represent an integral number of
* sample frames, such that:
* <br>
* <center>{@code [ bytes read ] % [frame size in bytes ] == 0}</center>
* <br>
* <p style="text-align:center">
* {@code [ bytes read ] % [frame size in bytes ] == 0}
* <p>
* The return value will always meet this requirement. A request to read a
* number of bytes representing a non-integral number of sample frames
* cannot be fulfilled and may result in an IllegalArgumentException.

View File

@ -69,7 +69,7 @@ import java.beans.*;
* are desired, and use simple <code>ActionListener</code>s elsewhere.
* <br>
*
* <h3><a name="buttonActions"></a>Swing Components Supporting <code>Action</code></h3>
* <h3><a id="buttonActions"></a>Swing Components Supporting <code>Action</code></h3>
* <p>
* Many of Swing's components have an <code>Action</code> property. When
* an <code>Action</code> is set on a component, the following things
@ -96,34 +96,34 @@ import java.beans.*;
*
* <table border="1" cellpadding="1" cellspacing="0"
* summary="Supported Action properties">
* <tr valign="top" align="left">
* <th style="background-color:#CCCCFF" align="left">Component Property
* <th style="background-color:#CCCCFF" align="left">Components
* <th style="background-color:#CCCCFF" align="left">Action Key
* <th style="background-color:#CCCCFF" align="left">Notes
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <th style="background-color:#CCCCFF;text-align:left">Component Property
* <th style="background-color:#CCCCFF;text-align:left">Components
* <th style="background-color:#CCCCFF;text-align:left">Action Key
* <th style="background-color:#CCCCFF;text-align:left">Notes
* <tr valign="top" style="text-align:left">
* <td><b><code>enabled</code></b>
* <td>All
* <td>The <code>isEnabled</code> method
* <td>&nbsp;
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>toolTipText</code></b>
* <td>All
* <td><code>SHORT_DESCRIPTION</code>
* <td>&nbsp;
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>actionCommand</code></b>
* <td>All
* <td><code>ACTION_COMMAND_KEY</code>
* <td>&nbsp;
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>mnemonic</code></b>
* <td>All buttons
* <td><code>MNEMONIC_KEY</code>
* <td>A <code>null</code> value or <code>Action</code> results in the
* button's <code>mnemonic</code> property being set to
* <code>'\0'</code>.
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>text</code></b>
* <td>All buttons
* <td><code>NAME</code>
@ -139,7 +139,7 @@ import java.beans.*;
* <code>true</code> if the <code>Action</code> has a
* non-<code>null</code> value for <code>LARGE_ICON_KEY</code> or
* <code>SMALL_ICON</code>.
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>displayedMnemonicIndex</code></b>
* <td>All buttons
* <td><code>DISPLAYED_MNEMONIC_INDEX_KEY</code>
@ -150,7 +150,7 @@ import java.beans.*;
* mnemonic index is not updated. In any subsequent changes to
* <code>DISPLAYED_MNEMONIC_INDEX_KEY</code>, <code>null</code>
* is treated as -1.
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>icon</code></b>
* <td>All buttons except of <code>JCheckBox</code>,
* <code>JToggleButton</code> and <code>JRadioButton</code>.
@ -160,13 +160,13 @@ import java.beans.*;
* <code>SMALL_ICON</code>. All other buttons will use
* <code>LARGE_ICON_KEY</code>; if the value is <code>null</code> they
* use <code>SMALL_ICON</code>.
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>accelerator</code></b>
* <td>All <code>JMenuItem</code> subclasses, with the exception of
* <code>JMenu</code>.
* <td><code>ACCELERATOR_KEY</code>
* <td>&nbsp;
* <tr valign="top" align="left">
* <tr valign="top" style="text-align:left">
* <td><b><code>selected</code></b>
* <td><code>JToggleButton</code>, <code>JCheckBox</code>,
* <code>JRadioButton</code>, <code>JCheckBoxMenuItem</code> and

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -38,7 +38,7 @@ import java.io.PrintStream;
* arranged when the frame is resized.
* <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
* <TR>
* <TD ALIGN="CENTER">
* <TD style="text-align:center">
* <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/BoxLayout-1.gif"
* alt="The following text describes this graphic."
* WIDTH="191" HEIGHT="201" STYLE="FLOAT:BOTTOM; BORDER:0">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -40,7 +40,7 @@ import sun.swing.DefaultLookup;
/**
* Renders an item in a list.
* <p>
* <strong><a name="override">Implementation Note:</a></strong>
* <strong><a id="override">Implementation Note:</a></strong>
* This class overrides
* <code>invalidate</code>,
* <code>validate</code>,

Some files were not shown because too many files have changed in this diff Show More