-
Type:
Sub-task
-
Resolution: Fixed
-
Priority:
P2
-
Affects Version/s: None
-
Component/s: core-libs
-
b103
-
Verified
Consider the following code:
Spliterator<Object> spliterator = Collections.nCopies(0, new Object()).spliterator();
spliterator.tryAdvance((Consumer)null);
spliterator.forEachRemaining((Consumer)null);
The expected NPEs would not be thrown.
The following JCK tests will fail due to this issue:
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[characteristics_ORDERED]
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[forEachRemaining_NPE]
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[hasCharacteristics_ORDERED]
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[tryAdvance_NPE]
api/java_util/Collections/ncopies/index.html#NCopiesStream[checkSpliterator]
api/java_util/Collections/ncopies/index.html#NCopiesParallelStream[checkSpliterator]
Spliterator<Object> spliterator = Collections.nCopies(0, new Object()).spliterator();
spliterator.tryAdvance((Consumer)null);
spliterator.forEachRemaining((Consumer)null);
The expected NPEs would not be thrown.
The following JCK tests will fail due to this issue:
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[characteristics_ORDERED]
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[forEachRemaining_NPE]
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[hasCharacteristics_ORDERED]
api/java_util/Collections/ncopies/index.html#NCopiesSpliteratorEmpty[tryAdvance_NPE]
api/java_util/Collections/ncopies/index.html#NCopiesStream[checkSpliterator]
api/java_util/Collections/ncopies/index.html#NCopiesParallelStream[checkSpliterator]