Changeset 19102 in josm


Ignore:
Timestamp:
2024-06-12T12:32:03+02:00 (5 months ago)
Author:
taylor.smock
Message:

Revert Utils.toUnmodifiableList changes from r19101 (see #23727, patch by GerdP, modified with extra context)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r19101 r19102  
    636636    @SuppressWarnings("unchecked")
    637637    public static <T> List<T> toUnmodifiableList(Collection<T> collection) {
     638        // Note: Windows does a `null` check on startup on these lists. See #23717.
     639        // Only change this once that is fixed.
     640        // Java 9: use List.of(...)
    638641        if (isEmpty(collection)) {
    639642            return Collections.emptyList();
     
    641644            return Collections.singletonList(collection.iterator().next());
    642645        } else {
    643             // List.copyOf would also work, but if the original collection is immutable, it just returns the original
    644             // collection.
    645             return (List<T>) List.of(collection.toArray());
     646            return (List<T>) Arrays.asList(collection.toArray());
    646647        }
    647648    }
Note: See TracChangeset for help on using the changeset viewer.