[lworld] RFR: 8336669: [lworld] Some Collection tests fail when run with migrated classes because they assume wrapper classes instances have identity
Rémi Forax
forax at openjdk.org
Thu Jul 25 12:13:43 UTC 2024
On Thu, 25 Jul 2024 11:29:21 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Updated tests not not assume Integer has identity.
>
> modified: test/jdk/java/util/Collection/IteratorAtEnd.java
> modified: test/jdk/java/util/Collections/CheckedIdentityMap.java
> modified: test/jdk/java/util/Collections/CheckedListBash.java
> modified: test/jdk/java/util/HashMap/ToArray.java
> modified: test/jdk/java/util/Map/Get.java
> modified: test/jdk/java/util/Map/LockStep.java
> modified: test/jdk/java/util/Map/ToArray.java
test/jdk/java/util/HashMap/ToArray.java line 46:
> 44: @Override
> 45: public int compareTo(Int o) {
> 46: if (!(o instanceof Int other)) {
`o` is already an `Int`
test/jdk/java/util/Map/Get.java line 50:
> 48: @Override
> 49: public int compareTo(Char ch) {
> 50: if (!(ch instanceof Char other)) {
same as above
test/jdk/java/util/Map/LockStep.java line 56:
> 54: // identity for WeakHashMap
> 55: private record Int(int intValue) implements Comparable<Int> {
> 56: private static Map<Integer, Int> interned = new HashMap<>(100);
should be `final` too ?
test/jdk/java/util/Map/LockStep.java line 65:
> 63: @Override
> 64: public int compareTo(Int o) {
> 65: if (!(o instanceof Int other)) {
same ...
test/jdk/java/util/Map/ToArray.java line 46:
> 44:
> 45: private static void realMain(String[] args) throws Throwable {
> 46: Map<String, Long>[] maps = (Map<String, Long>[]) new Map[]{
should be `new Map<?,?>[] {`
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1181#discussion_r1691332906
PR Review Comment: https://git.openjdk.org/valhalla/pull/1181#discussion_r1691333448
PR Review Comment: https://git.openjdk.org/valhalla/pull/1181#discussion_r1691334782
PR Review Comment: https://git.openjdk.org/valhalla/pull/1181#discussion_r1691335090
PR Review Comment: https://git.openjdk.org/valhalla/pull/1181#discussion_r1691336766
More information about the valhalla-dev
mailing list