-
Bug
-
Resolution: Fixed
-
P2
-
8u5
-
b22
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8063733 | 8u45 | Unassigned | P2 | Resolved | Fixed | b01 |
JDK-8049468 | 8u40 | Mike Duigou | P2 | Resolved | Fixed | b01 |
JDK-8051659 | 8u31 | Mike Duigou | P2 | Resolved | Fixed | b01 |
JDK-8050944 | 8u25 | Mike Duigou | P2 | Resolved | Fixed | b08 |
JDK-8050476 | 8u20 | Mike Duigou | P2 | Closed | Fixed | b23 |
JDK-8070184 | emb-8u47 | Unassigned | P2 | Resolved | Fixed | team |
JDK-8053513 | emb-8u26 | Mike Duigou | P2 | Resolved | Fixed | b17 |
A DESCRIPTION OF THE PROBLEM :
The replaceAll method of a list returned by java.util.Collections.checkedList passes the replacement operator directly to the underlying list, enabling violation of the type checking.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
import java.util.function.UnaryOperator;
class CheckedListViolationBug {
public static void main(String... args) {
// Create a runtime-checked List of Integers only
List<Integer> integersOnly = Collections.checkedList(new ArrayList<>(), Integer.class);
integersOnly.add(1);
integersOnly.add(2);
integersOnly.add(3);
// the UnaryOperator bypasses the check, enabling insertion of arbitrary elements
integersOnly.replaceAll((UnaryOperator)(e -> "ha!"));
// the list now contains Strings:
System.out.println(integersOnly);
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8049468 Collections.checkedList checking bypassed by List.replaceAll
- Resolved
-
JDK-8050944 Collections.checkedList checking bypassed by List.replaceAll
- Resolved
-
JDK-8051659 Collections.checkedList checking bypassed by List.replaceAll
- Resolved
-
JDK-8053513 Collections.checkedList checking bypassed by List.replaceAll
- Resolved
-
JDK-8063733 Collections.checkedList checking bypassed by List.replaceAll
- Resolved
-
JDK-8070184 Collections.checkedList checking bypassed by List.replaceAll
- Resolved
-
JDK-8050476 Collections.checkedList checking bypassed by List.replaceAll
- Closed
- relates to
-
JDK-8053938 Collections.checkedList(empty list).replaceAll((UnaryOperator)null) doesn't throw NPE after JDK-8047795
- Closed