Skip to content

Commit d8dec8f

Browse files
author
duke
committed
Merge
2 parents e01b0d5 + 7c71a76 commit d8dec8f

File tree

305 files changed

+42738
-771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+42738
-771
lines changed

jdk/.hgtags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,4 @@ baeb5edb38939cdb78ae0ac6f4fd368465cbf188 jdk-9+116
362362
4da0f73ce03aaf245b92cc040cc0ab0e3fa54dc2 jdk-9+117
363363
e1eba5cfa5cc8c66d524396a05323dc93568730a jdk-9+118
364364
bad3f8a33db271a6143ba6eac0c8bd5bbd942417 jdk-9+119
365+
b9a518bf72516954e57ac2f6e3ef21e13008f1cd jdk-9+120

jdk/make/mapfiles/libjava/mapfile-vers

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ SUNWprivate_1.1 {
267267
Java_jdk_internal_misc_VM_geteuid;
268268
Java_jdk_internal_misc_VM_getgid;
269269
Java_jdk_internal_misc_VM_getegid;
270+
Java_jdk_internal_misc_VM_getRuntimeArguments;
270271
Java_jdk_internal_misc_VM_initialize;
271272

272273
Java_java_lang_reflect_Module_defineModule0;

jdk/src/java.base/share/classes/java/lang/Boolean.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ public Boolean(String s) {
117117
* Parses the string argument as a boolean. The {@code boolean}
118118
* returned represents the value {@code true} if the string argument
119119
* is not {@code null} and is equal, ignoring case, to the string
120-
* {@code "true"}. <p>
120+
* {@code "true"}.
121+
* Otherwise, a false value is returned, including for a null
122+
* argument.<p>
121123
* Example: {@code Boolean.parseBoolean("True")} returns {@code true}.<br>
122124
* Example: {@code Boolean.parseBoolean("yes")} returns {@code false}.
123125
*
@@ -165,6 +167,8 @@ public static Boolean valueOf(boolean b) {
165167
* specified string. The {@code Boolean} returned represents a
166168
* true value if the string argument is not {@code null}
167169
* and is equal, ignoring case, to the string {@code "true"}.
170+
* Otherwise, a false value is returned, including for a null
171+
* argument.
168172
*
169173
* @param s a string.
170174
* @return the {@code Boolean} value represented by the string.
@@ -241,14 +245,12 @@ public boolean equals(Object obj) {
241245

242246
/**
243247
* Returns {@code true} if and only if the system property named
244-
* by the argument exists and is equal to the string {@code
245-
* "true"}. (Beginning with version 1.0.2 of the Java&trade;
246-
* platform, the test of this string is case insensitive.) A
247-
* system property is accessible through {@code getProperty}, a
248-
* method defined by the {@code System} class.
249-
* <p>
250-
* If there is no property with the specified name, or if the specified
251-
* name is empty or null, then {@code false} is returned.
248+
* by the argument exists and is equal to, ignoring case, the
249+
* string {@code "true"}.
250+
* A system property is accessible through {@code getProperty}, a
251+
* method defined by the {@code System} class. <p> If there is no
252+
* property with the specified name, or if the specified name is
253+
* empty or null, then {@code false} is returned.
252254
*
253255
* @param name the system property name.
254256
* @return the {@code boolean} value of the system property.

jdk/src/java.base/share/classes/java/lang/StackWalker.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,9 @@ public static StackWalker getInstance(Set<Option> options) {
306306
return DEFAULT_WALKER;
307307
}
308308

309-
checkPermission(options);
310-
return new StackWalker(toEnumSet(options));
309+
EnumSet<Option> optionSet = toEnumSet(options);
310+
checkPermission(optionSet);
311+
return new StackWalker(optionSet);
311312
}
312313

313314
/**
@@ -341,8 +342,9 @@ public static StackWalker getInstance(Set<Option> options, int estimateDepth) {
341342
if (estimateDepth <= 0) {
342343
throw new IllegalArgumentException("estimateDepth must be > 0");
343344
}
344-
checkPermission(options);
345-
return new StackWalker(toEnumSet(options), estimateDepth);
345+
EnumSet<Option> optionSet = toEnumSet(options);
346+
checkPermission(optionSet);
347+
return new StackWalker(optionSet, estimateDepth);
346348
}
347349

348350
// ----- private constructors ------
@@ -540,13 +542,11 @@ public Class<?> getCallerClass() {
540542
}
541543

542544
// ---- package access ----
543-
static StackWalker newInstanceNoCheck(EnumSet<Option> options) {
544-
return new StackWalker(options, 0, null);
545-
}
546545

547546
static StackWalker newInstance(Set<Option> options, ExtendedOption extendedOption) {
548-
checkPermission(options);
549-
return new StackWalker(toEnumSet(options), 0, extendedOption);
547+
EnumSet<Option> optionSet = toEnumSet(options);
548+
checkPermission(optionSet);
549+
return new StackWalker(optionSet, 0, extendedOption);
550550
}
551551

552552
int estimateDepth() {

jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* {@code @Target(ElementType.FIELD)} may only be written as a modifier for a
4747
* field declaration.
4848
*
49-
* <p>The constant {@link #TYPE_USE} corresponds to the 15 type contexts in JLS
49+
* <p>The constant {@link #TYPE_USE} corresponds to the type contexts in JLS
5050
* 4.11, as well as to two declaration contexts: type declarations (including
5151
* annotation type declarations) and type parameter declarations.
5252
*

jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.io.InputStream;
3131
import java.net.URI;
3232
import java.nio.ByteBuffer;
33+
import java.util.Objects;
3334
import java.util.Optional;
3435

3536

@@ -163,9 +164,12 @@ default Optional<ByteBuffer> read(String name) throws IOException {
163164
* @param bb
164165
* The byte buffer to release
165166
*
166-
* @implSpec The default implementation does nothing.
167+
* @implSpec The default implementation doesn't do anything except check
168+
* if the byte buffer is null.
167169
*/
168-
default void release(ByteBuffer bb) { }
170+
default void release(ByteBuffer bb) {
171+
Objects.requireNonNull(bb);
172+
}
169173

170174
/**
171175
* Closes the module reader. Once closed then subsequent calls to locate or

jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ private static void checkPermissionToConnect(URI uri) {
272272
* if not found.
273273
*/
274274
private ImageLocation findImageLocation(String name) throws IOException {
275+
Objects.requireNonNull(name);
275276
if (closed)
276277
throw new IOException("ModuleReader is closed");
277-
278278
if (imageReader != null) {
279279
return imageReader.findLocation(module, name);
280280
} else {
@@ -322,6 +322,7 @@ public Optional<ByteBuffer> read(String name) throws IOException {
322322

323323
@Override
324324
public void release(ByteBuffer bb) {
325+
Objects.requireNonNull(bb);
325326
ImageReader.releaseByteBuffer(bb);
326327
}
327328

jdk/src/java.base/share/classes/java/lang/reflect/Layer.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@
7575
*
7676
* <p> A Java virtual machine has at least one non-empty layer, the {@link
7777
* #boot() boot} layer, that is created when the Java virtual machine is
78-
* started. The <em>system modules</em>, including {@code java.base}, are in
79-
* the boot layer. The modules in the boot layer are mapped to the bootstrap
80-
* class loader and other class loaders that are built-in into the Java virtual
81-
* machine. The boot layer will often be the {@link #parent() parent} when
82-
* creating additional layers. </p>
78+
* started. The boot layer contains module {@code java.base} and is the only
79+
* layer in the Java virtual machine with a module named "{@code java.base}".
80+
* The modules in the boot layer are mapped to the bootstrap class loader and
81+
* other class loaders that are <a href="../ClassLoader.html#builtinLoaders">
82+
* built-in</a> into the Java virtual machine. The boot layer will often be
83+
* the {@link #parent() parent} when creating additional layers. </p>
8384
*
8485
* <p> As when creating a {@code Configuration},
8586
* {@link ModuleDescriptor#isAutomatic() automatic} modules receive
@@ -204,7 +205,8 @@ private Layer(Configuration cf,
204205
* for this layer
205206
* @throws LayerInstantiationException
206207
* If all modules cannot be defined to the same class loader for any
207-
* of the reasons listed above
208+
* of the reasons listed above or the layer cannot be created because
209+
* the configuration contains a module named "{@code java.base}"
208210
* @throws SecurityException
209211
* If {@code RuntimePermission("createClassLoader")} or
210212
* {@code RuntimePermission("getClassLoader")} is denied by
@@ -219,14 +221,13 @@ public Layer defineModulesWithOneLoader(Configuration cf,
219221
checkCreateClassLoaderPermission();
220222
checkGetClassLoaderPermission();
221223

222-
Loader loader;
223224
try {
224-
loader = new Loader(cf.modules(), parentLoader);
225+
Loader loader = new Loader(cf.modules(), parentLoader);
225226
loader.initRemotePackageMap(cf, this);
227+
return new Layer(cf, this, mn -> loader);
226228
} catch (IllegalArgumentException e) {
227229
throw new LayerInstantiationException(e.getMessage());
228230
}
229-
return new Layer(cf, this, mn -> loader);
230231
}
231232

232233

@@ -266,6 +267,9 @@ public Layer defineModulesWithOneLoader(Configuration cf,
266267
* @throws IllegalArgumentException
267268
* If the parent of the given configuration is not the configuration
268269
* for this layer
270+
* @throws LayerInstantiationException
271+
* If the layer cannot be created because the configuration contains
272+
* a module named "{@code java.base}"
269273
* @throws SecurityException
270274
* If {@code RuntimePermission("createClassLoader")} or
271275
* {@code RuntimePermission("getClassLoader")} is denied by
@@ -281,7 +285,11 @@ public Layer defineModulesWithManyLoaders(Configuration cf,
281285
checkGetClassLoaderPermission();
282286

283287
LoaderPool pool = new LoaderPool(cf, this, parentLoader);
284-
return new Layer(cf, this, pool::loaderFor);
288+
try {
289+
return new Layer(cf, this, pool::loaderFor);
290+
} catch (IllegalArgumentException e) {
291+
throw new LayerInstantiationException(e.getMessage());
292+
}
285293
}
286294

287295

@@ -330,7 +338,8 @@ public Layer defineModulesWithManyLoaders(Configuration cf,
330338
* for this layer
331339
* @throws LayerInstantiationException
332340
* If creating the {@code Layer} fails for any of the reasons
333-
* listed above
341+
* listed above or the layer cannot be created because the
342+
* configuration contains a module named "{@code java.base}"
334343
* @throws SecurityException
335344
* If {@code RuntimePermission("getClassLoader")} is denied by
336345
* the security manager

jdk/src/java.base/share/classes/java/lang/reflect/Module.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ private boolean isExportedReflectively(String pn, Module other) {
513513
* package {@code pn} to the given module.
514514
*
515515
* <p> This method has no effect if the package is already exported to the
516-
* given module. If also has no effect if invoked on an unnamed module (as
516+
* given module. It also has no effect if invoked on an unnamed module (as
517517
* unnamed modules export all packages). </p>
518518
*
519519
* @param pn
@@ -866,7 +866,7 @@ static Map<String, Module> defineModules(Configuration cf,
866866
URI uri = mref.location().orElse(null);
867867

868868
Module m;
869-
if (loader == null && name.equals("java.base")) {
869+
if (loader == null && name.equals("java.base") && Layer.boot() == null) {
870870
m = Object.class.getModule();
871871
} else {
872872
m = new Module(layer, loader, descriptor, uri);

0 commit comments

Comments
 (0)