提交 ac721699 编写于 作者: C coffeys

Merge

......@@ -311,6 +311,7 @@ d723d05cd17afd5c4dd4293bcba83fef44a3c0bb jdk8u20-b16
be30cb2a3088f2b7b334b499f7eddbd5312312a7 jdk8u20-b23
dfb9f24d56b51e5a2ca26e77fc69a2464d51a4d3 jdk8u20-b24
dfb9f24d56b51e5a2ca26e77fc69a2464d51a4d3 jdk8u20-b25
dd229c5f57bff4e75a70908294a13072b9a48385 jdk8u20-b26
abca9f6f1a10e9f91b2538bbe7870f54f550d986 jdk8u25-b00
7d0627679c9fdeaaaa9fe15c7cc11af0763621ec jdk8u25-b01
b0277ec994b751ebb761814675352506cd56bcd6 jdk8u25-b02
......
......@@ -3486,6 +3486,7 @@ public class Collections {
*/
@Override
public void replaceAll(UnaryOperator<E> operator) {
Objects.requireNonNull(operator);
list.replaceAll(e -> typeCheck(operator.apply(e)));
}
......
......@@ -23,7 +23,7 @@
/*
* @test
* @bug 8047795
* @bug 8047795 8053938
* @summary Ensure that replaceAll operator cannot add bad elements
* @author Mike Duigou
*/
......@@ -46,5 +46,16 @@ public class CheckedListReplaceAll {
thwarted.printStackTrace(System.out);
System.out.println("Curses! Foiled again!");
}
unwrapped = Arrays.asList(new Object[]{}); // Empty list
wrapped = Collections.checkedList(unwrapped, Integer.class);
try {
wrapped.replaceAll((UnaryOperator)null);
System.out.printf("Bwahaha! I have defeated you! %s\n", wrapped);
throw new RuntimeException("NPE not thrown when passed a null operator");
} catch (NullPointerException thwarted) {
thwarted.printStackTrace(System.out);
System.out.println("Curses! Foiled again!");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册