8169808: Stream returning methods should specify if they are late binding
Reviewed-by: martin
--- a/jdk/src/java.base/share/classes/java/lang/CharSequence.java Wed Nov 23 10:34:10 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/CharSequence.java Wed Nov 23 10:35:43 2016 -0800
@@ -121,8 +121,11 @@
* href="{@docRoot}/java/lang/Character.html#unicode">surrogate code
* point</a> is passed through uninterpreted.
*
- * <p>If the sequence is mutated while the stream is being read, the
- * result is undefined.
+ * <p>The stream binds to this sequence when the terminal stream operation
+ * commences (specifically, for mutable sequences the spliterator for the
+ * stream is <a href="../Spliterator.html#binding"><em>late-binding</em></a>).
+ * If the sequence is modified during that operation then the result is
+ * undefined.
*
* @return an IntStream of char values from this sequence
* @since 1.8
@@ -168,8 +171,11 @@
* unpaired surrogates, and undefined code units, are zero-extended to
* {@code int} values which are then passed to the stream.
*
- * <p>If the sequence is mutated while the stream is being read, the result
- * is undefined.
+ * <p>The stream binds to this sequence when the terminal stream operation
+ * commences (specifically, for mutable sequences the spliterator for the
+ * stream is <a href="../Spliterator.html#binding"><em>late-binding</em></a>).
+ * If the sequence is modified during that operation then the result is
+ * undefined.
*
* @return an IntStream of Unicode code points from this sequence
* @since 1.8
--- a/jdk/src/java.base/share/classes/java/util/BitSet.java Wed Nov 23 10:34:10 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/BitSet.java Wed Nov 23 10:35:43 2016 -0800
@@ -1210,9 +1210,10 @@
* is the number of bits in the set state, equal to the value
* returned by the {@link #cardinality()} method.
*
- * <p>The bit set must remain constant during the execution of the
- * terminal stream operation. Otherwise, the result of the terminal
- * stream operation is undefined.
+ * <p>The stream binds to this bit set when the terminal stream operation
+ * commences (specifically, the spliterator for the stream is
+ * <a href="../Spliterator.html#binding"><em>late-binding</em></a>). If the
+ * bit set is modified during that operation then the result is undefined.
*
* @return a stream of integers representing set indices
* @since 1.8