Ticket #23727: 23727.patch

File 23727.patch, 951 bytes (added by GerdP, 6 months ago)

This patch reverts just the change in Utils.toUnmodifiableList(). It makes JOSM start again, but why?

  • src/org/openstreetmap/josm/tools/Utils.java

     
    635635     */
    636636    @SuppressWarnings("unchecked")
    637637    public static <T> List<T> toUnmodifiableList(Collection<T> collection) {
     638        // Java 9: use List.of(...)
    638639        if (isEmpty(collection)) {
    639640            return Collections.emptyList();
    640641        } else if (collection.size() == 1) {
    641642            return Collections.singletonList(collection.iterator().next());
    642643        } 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());
     644            return (List<T>) Arrays.asList(collection.toArray());
    646645        }
    647646    }
    648647