JDK-8053938 : Collections.checkedList(empty list).replaceAll((UnaryOperator)null) doesn't throw NPE after JDK-8047795
  • Type: Bug
  • Component: core-libs
  • Affected Version: 8u20,8u25
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-07-30
  • Updated: 2015-01-21
  • Resolved: 2014-07-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u20Fixed 9 b26Fixed
Related Reports
Relates :  
The JavaSE 8 specification for j.u.List
contains the following assertion:
"NullPointerException - if the specified operator is null"

This assertion has been satisfied by the following code sample:

        Collections.checkedList(Arrays.asList(), Object.class).replaceAll((UnaryOperator)null);

before the fix for JDK-8047795 but is not satisfied after the fix.

The following JCK8 testcase fails due to this:


Verified by the regression test provided with this fix and the jck test api/java_util/Collections/checked/CheckedListReplaceAll.html

SQE confirmed this is a TCK-RED bug and Dev is working on a fix. Therefore - I've marked this as 8u20-critical-approved.

The code was updated to: public void replaceAll(UnaryOperator<E> operator) { list.replaceAll(e -> typeCheck(operator.apply(e))); } but we forgot the now required explicit null-check on the operator before the call to the underlying list.replaceAll.

The test has failed with 8u20 since b23 where JDK-8047795 was integrated. Please see the log attached.