RFR: jsr166 jdk10 integration wave 4
This wave introduces a more clickable overview Home Page: http://cr.openjdk.java.net/~martin/webrevs/openjdk10/jsr166-integration/over... 8188900: ConcurrentLinkedDeque linearizability 8188853: java/util/concurrent/ExecutorService/Invoke.java Assertion failure 8188047: Add SplittableRandom.nextBytes 8187941: Add StampedLock stamp inspection methods 8188575: Miscellaneous changes imported from jsr166 CVS 2017-10
Looks good, one minor comment below.
On 11 Oct 2017, at 14:42, Martin Buchholz <martinrb@google.com> wrote:
This wave introduces a more clickable overview Home Page:
http://cr.openjdk.java.net/~martin/webrevs/openjdk10/jsr166-integration/over...
8188900: ConcurrentLinkedDeque linearizability 8188853: java/util/concurrent/ExecutorService/Invoke.java Assertion failure 8188047: Add SplittableRandom.nextBytes
SplittableRandomTest.java — 592 int n = sr.nextInt(20); nextInt(1, 20) ? so you get a byte array of 1 or more in length. Paul.
8187941: Add StampedLock stamp inspection methods 8188575: Miscellaneous changes imported from jsr166 CVS 2017-10
On Thu, Oct 12, 2017 at 5:32 PM, Paul Sandoz <paul.sandoz@oracle.com> wrote:
SplittableRandomTest.java —
592 int n = sr.nextInt(20);
nextInt(1, 20) ? so you get a byte array of 1 or more in length.
Yes, I see now there is no testing at all when n == 0. Empty array and null array are both worth testing, so: Index: SplittableRandomTest.java =================================================================== RCS file: /export/home/jsr166/jsr166/jsr166/src/test/tck/SplittableRandomTest.java,v retrieving revision 1.22 diff -u -r1.22 SplittableRandomTest.java --- SplittableRandomTest.java 3 Oct 2017 22:27:04 -0000 1.22 +++ SplittableRandomTest.java 13 Oct 2017 02:31:20 -0000 @@ -562,7 +562,7 @@ */ public void testNextBytes() { SplittableRandom sr = new SplittableRandom(); - int n = sr.nextInt(20); + int n = sr.nextInt(1, 20); byte[] bytes = new byte[n]; outer: for (int i = 0; i < n; i++) { @@ -577,4 +577,18 @@ } } + /** + * Filling an empty array with random bytes succeeds without effect. + */ + public void testNextBytes_emptyArray() { + new SplittableRandom().nextBytes(new byte[0]); + } + + public void testNextBytes_nullArray() { + try { + new SplittableRandom().nextBytes(null); + shouldThrow(); + } catch (NullPointerException success) {} + } + }
participants (2)
-
Martin Buchholz
-
Paul Sandoz