Index: /trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java	(revision 11017)
@@ -59,5 +59,5 @@
 
     protected static Layer askTargetLayer(List<Layer> targetLayers) {
-        return askTargetLayer(targetLayers.toArray(new Layer[0]),
+        return askTargetLayer(targetLayers.toArray(new Layer[targetLayers.size()]),
                 tr("Please select the target layer."),
                 tr("Select target layer"),
Index: /trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java	(revision 11017)
@@ -12,4 +12,5 @@
 import java.net.MalformedURLException;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
@@ -92,5 +93,6 @@
             final WMSLayerTree tree = new WMSLayerTree();
             tree.updateTree(wms);
-            final JComboBox<String> formats = new JComboBox<>(wms.getFormats().toArray(new String[0]));
+            List<String> wmsFormats = wms.getFormats();
+            final JComboBox<String> formats = new JComboBox<>(wmsFormats.toArray(new String[wmsFormats.size()]));
             formats.setSelectedItem(wms.getPreferredFormats());
             formats.setToolTipText(tr("Select image format for WMS layer"));
Index: /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 11017)
@@ -163,5 +163,5 @@
         SelectLayerDialog(Collection<Layer> layers) {
             super(Main.parent, tr("Select WMTS layer"), new String[]{tr("Add layers"), tr("Cancel")});
-            this.layers = layers.toArray(new Layer[]{});
+            this.layers = layers.toArray(new Layer[layers.size()]);
             //getLayersTable(layers, Main.getProjection())
             this.list = new JTable(
Index: /trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 11017)
@@ -172,5 +172,5 @@
             build();
             lblMessage.setText(msg);
-            lstLayers.setListData(infos.toArray(new SaveLayerInfo[0]));
+            lstLayers.setListData(infos.toArray(new SaveLayerInfo[infos.size()]));
         }
 
Index: /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 11017)
@@ -77,5 +77,5 @@
         ret.add(new LayerSaveAsAction(this));
         ret.add(new BookmarkWmsAction());
-        return ret.toArray(new Action[]{});
+        return ret.toArray(new Action[ret.size()]);
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 11017)
@@ -416,5 +416,5 @@
             Collections.sort(vtTimezones);
 
-            JosmComboBox<String> cbTimezones = new JosmComboBox<>(vtTimezones.toArray(new String[0]));
+            JosmComboBox<String> cbTimezones = new JosmComboBox<>(vtTimezones.toArray(new String[vtTimezones.size()]));
 
             String tzId = Main.pref.get("geoimage.timezoneid", "");
@@ -567,5 +567,5 @@
         panelCb.add(new JLabel(tr("GPX track: ")));
 
-        cbGpx = new JosmComboBox<>(gpxLst.toArray(new GpxDataWrapper[0]));
+        cbGpx = new JosmComboBox<>(gpxLst.toArray(new GpxDataWrapper[gpxLst.size()]));
         if (defaultItem != null) {
             cbGpx.setSelectedItem(defaultItem);
Index: /trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java	(revision 11017)
@@ -123,5 +123,5 @@
             return null;
         }
-        return AbstractMergeAction.askTargetLayer(targetLayers.toArray(new AbstractTileSourceLayer[0]),
+        return AbstractMergeAction.askTargetLayer(targetLayers.toArray(new AbstractTileSourceLayer[targetLayers.size()]),
                 tr("Please select the imagery layer."),
                 tr("Select imagery layer"),
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java	(revision 11017)
@@ -7,4 +7,5 @@
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.List;
 
 import javax.swing.DefaultComboBoxModel;
@@ -73,5 +74,6 @@
                 wms.attemptGetCapabilities(rawUrl.getText());
                 tree.updateTree(wms);
-                formats.setModel(new DefaultComboBoxModel<>(wms.getFormats().toArray(new String[0])));
+                List<String> wmsFormats = wms.getFormats();
+                formats.setModel(new DefaultComboBoxModel<>(wmsFormats.toArray(new String[wmsFormats.size()])));
                 formats.setSelectedItem(wms.getPreferredFormats());
             } catch (MalformedURLException ex1) {
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java	(revision 11017)
@@ -92,5 +92,5 @@
             filter.getDocument().addDocumentListener(this);
 
-            selectionList = new JList<>(data.toArray(new String[0]));
+            selectionList = new JList<>(data.toArray(new String[data.size()]));
             selectionList.setModel(model);
             JScrollPane scroll = new JScrollPane(selectionList);
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java	(revision 11017)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.preferences.projection;
 
+import static org.openstreetmap.josm.data.SystemOfMeasurement.ALL_SYSTEMS;
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -271,5 +272,5 @@
     private static final CollectionProperty PROP_SUB_PROJECTION = new CollectionProperty("projection.sub", null);
     public static final StringProperty PROP_SYSTEM_OF_MEASUREMENT = new StringProperty("system_of_measurement", "Metric");
-    private static final String[] unitsValues = (new ArrayList<>(SystemOfMeasurement.ALL_SYSTEMS.keySet())).toArray(new String[0]);
+    private static final String[] unitsValues = ALL_SYSTEMS.keySet().toArray(new String[ALL_SYSTEMS.size()]);
     private static final String[] unitsValuesTr = new String[unitsValues.length];
     static {
@@ -282,5 +283,6 @@
      * Combobox with all projections available
      */
-    private final JosmComboBox<ProjectionChoice> projectionCombo = new JosmComboBox<>(projectionChoices.toArray(new ProjectionChoice[0]));
+    private final JosmComboBox<ProjectionChoice> projectionCombo = new JosmComboBox<>(
+            projectionChoices.toArray(new ProjectionChoice[projectionChoices.size()]));
 
     /**
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java	(revision 11017)
@@ -44,5 +44,5 @@
      */
     public UTMProjectionChoice() {
-        super(tr("UTM"), /* NO-ICON */ "core:utm", cbEntries.toArray(new String[0]), tr("UTM Zone"));
+        super(tr("UTM"), /* NO-ICON */ "core:utm", cbEntries.toArray(new String[cbEntries.size()]), tr("UTM Zone"));
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(revision 11017)
@@ -225,5 +225,5 @@
         cbAlt.setText(ALT); // see above for why no tr()
         tfKey.setAction(action);
-        tfKey.setModel(new DefaultComboBoxModel<>(keyList.values().toArray(new String[0])));
+        tfKey.setModel(new DefaultComboBoxModel<>(keyList.values().toArray(new String[keyList.size()])));
         cbMeta.setAction(action);
         cbMeta.setText(META); // see above for why no tr()
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java	(revision 11017)
@@ -49,5 +49,5 @@
         }
 
-        combobox = new JosmComboBox<>(lhm.values().toArray(new PresetListEntry[0]));
+        combobox = new JosmComboBox<>(lhm.values().toArray(new PresetListEntry[lhm.size()]));
         component = combobox;
         combobox.setRenderer(getListCellRenderer());
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelect.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelect.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelect.java	(revision 11017)
@@ -26,5 +26,5 @@
     @Override
     protected void addToPanelAnchor(JPanel p, String def, boolean presetInitiallyMatches) {
-        list = new ConcatenatingJList(delimiter, lhm.values().toArray(new PresetListEntry[0]));
+        list = new ConcatenatingJList(delimiter, lhm.values().toArray(new PresetListEntry[lhm.size()]));
         component = list;
         ListCellRenderer<PresetListEntry> renderer = getListCellRenderer();
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java	(revision 11017)
@@ -106,5 +106,5 @@
         } else {
             // the objects have different values
-            JosmComboBox<String> comboBox = new JosmComboBox<>(usage.values.toArray(new String[0]));
+            JosmComboBox<String> comboBox = new JosmComboBox<>(usage.values.toArray(new String[usage.values.size()]));
             comboBox.setEditable(true);
             comboBox.setEditor(textField);
Index: /trunk/src/org/openstreetmap/josm/gui/widgets/NativeFileChooser.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/widgets/NativeFileChooser.java	(revision 11016)
+++ /trunk/src/org/openstreetmap/josm/gui/widgets/NativeFileChooser.java	(revision 11017)
@@ -56,5 +56,5 @@
         // https://bugs.openjdk.java.net/browse/JDK-4811090 : Extend awt filedialog
         // https://bugs.openjdk.java.net/browse/JDK-6192906 : Add more features to java.awt.FileDialog
-        return fileFilters.toArray(new FileFilter[0]);
+        return fileFilters.toArray(new FileFilter[fileFilters.size()]);
     }
 
