--- a/jdk/src/java.base/share/classes/java/util/stream/Collectors.java Thu Dec 08 15:46:19 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/stream/Collectors.java Wed Dec 14 03:09:12 2016 +0100
@@ -1268,10 +1268,16 @@
* to a {@code Predicate}, and organizes them into a
* {@code Map<Boolean, List<T>>}.
*
+ * The returned {@code Map} always contains mappings for both
+ * {@code false} and {@code true} keys.
* There are no guarantees on the type, mutability,
* serializability, or thread-safety of the {@code Map} or {@code List}
* returned.
*
+ * @apiNote
+ * If a partition has no elements, its value in the result Map will be
+ * an empty List.
+ *
* @param <T> the type of the input elements
* @param predicate a predicate used for classifying input elements
* @return a {@code Collector} implementing the partitioning operation
@@ -1290,9 +1296,17 @@
* {@code Map<Boolean, D>} whose values are the result of the downstream
* reduction.
*
- * <p>There are no guarantees on the type, mutability,
+ * <p>
+ * The returned {@code Map} always contains mappings for both
+ * {@code false} and {@code true} keys.
+ * There are no guarantees on the type, mutability,
* serializability, or thread-safety of the {@code Map} returned.
*
+ * @apiNote
+ * If a partition has no elements, its value in the result Map will be
+ * obtained by calling the downstream collector's supplier function and then
+ * applying the finisher function.
+ *
* @param <T> the type of the input elements
* @param <A> the intermediate accumulation type of the downstream collector
* @param <D> the result type of the downstream reduction
--- a/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Thu Dec 08 15:46:19 2016 +0100
+++ b/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Wed Dec 14 03:09:12 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -30,12 +30,10 @@
* java.rmi.ConnectException or ConnectIOException, not a MarshalException.
* @author Peter Jones
*
- * @library ../../testlibrary
* @modules java.rmi/sun.rmi.registry
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
- * @build TestLibrary
* @run main/othervm HandshakeFailure
*/
@@ -49,7 +47,6 @@
public class HandshakeFailure {
- private static final int PORT = TestLibrary.getUnusedRandomPort();
private static final int TIMEOUT = 10000;
public static void main(String[] args) throws Exception {
@@ -57,12 +54,13 @@
/*
* Listen on port...
*/
- ServerSocket serverSocket = new ServerSocket(PORT);
+ ServerSocket serverSocket = new ServerSocket(0);
+ int port = serverSocket.getLocalPort();
/*
* (Attempt RMI call to port in separate thread.)
*/
- Registry registry = LocateRegistry.getRegistry(PORT);
+ Registry registry = LocateRegistry.getRegistry(port);
Connector connector = new Connector(registry);
Thread t = new Thread(connector);
t.setDaemon(true);
@@ -93,7 +91,7 @@
System.err.println();
if (connector.exception instanceof MarshalException) {
- System.err.println(
+ throw new RuntimeException(
"TEST FAILED: MarshalException thrown, expecting " +
"java.rmi.ConnectException or ConnectIOException");
} else if (connector.exception instanceof ConnectException ||
--- a/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Thu Dec 08 15:46:19 2016 +0100
+++ b/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Wed Dec 14 03:09:12 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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,12 +33,10 @@
* this point (because no data for the invocation has yet been written).
* @author Peter Jones
*
- * @library ../../testlibrary
* @modules java.rmi/sun.rmi.registry
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
- * @build TestLibrary
* @run main/othervm HandshakeTimeout
*/
@@ -51,7 +49,6 @@
public class HandshakeTimeout {
- private static final int PORT = TestLibrary.getUnusedRandomPort();
private static final int TIMEOUT = 10000;
public static void main(String[] args) throws Exception {
@@ -62,12 +59,13 @@
/*
* Listen on port, but never process connections made to it.
*/
- ServerSocket serverSocket = new ServerSocket(PORT);
+ ServerSocket serverSocket = new ServerSocket(0);
+ int port = serverSocket.getLocalPort();
/*
* Attempt RMI call to port in separate thread.
*/
- Registry registry = LocateRegistry.getRegistry(PORT);
+ Registry registry = LocateRegistry.getRegistry(port);
Connector connector = new Connector(registry);
Thread t = new Thread(connector);
t.setDaemon(true);
@@ -91,7 +89,7 @@
System.err.println();
if (connector.exception instanceof MarshalException) {
- System.err.println(
+ throw new RuntimeException(
"TEST FAILED: MarshalException thrown, expecting " +
"java.rmi.ConnectException or ConnectIOException");
} else if (connector.exception instanceof ConnectException ||