diff --git a/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java b/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java
index 68d3b77a8..a9a38a30c 100644
--- a/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java
+++ b/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java
@@ -11,6 +11,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import javax.swing.AbstractAction;
 import javax.swing.Action;
@@ -81,7 +83,8 @@ public class LayerListPopup extends JPopupMenu {
         List<Action> actions;
         if (selectedLayers.size() == 1) {
             Action[] entries = selectedLayers.get(0).getMenuEntries();
-            actions = entries != null ? Arrays.asList(entries) : Collections.emptyList();
+            // Since we may add to the array later, we cannot use Arrays.asList -- it prohibits the use of `add` or `remove`.
+            actions = entries != null ? Stream.of(entries).collect(Collectors.toCollection(ArrayList::new)) : Collections.emptyList();
         } else {
             // Very simple algorithm - first selected layer has actions order as in getMenuEntries, actions from other layers go to the end
             actions = new ArrayList<>();
