Index: trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java	(revision 19101)
@@ -71,5 +71,5 @@
                 Way way = this.ways.get(waypos);
 
-                if (!this.reversed.get(waypos)) {
+                if (Boolean.FALSE.equals(this.reversed.get(waypos))) {
                     for (int pos = 0; pos < way.getNodesCount() - 1; pos++) {
                         ringNodes.add(way.getNode(pos));
@@ -212,5 +212,5 @@
                 //add cur way to the list
                 collectedWays.add(curWay);
-                collectedWaysReverse.add(Boolean.valueOf(curWayReverse));
+                collectedWaysReverse.add(curWayReverse);
 
                 if (nextNode == startNode) {
Index: trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java	(revision 19101)
@@ -92,7 +92,7 @@
             List<PrimitiveData> bufferCopy, List<PrimitiveData> toSelect) {
         EnumMap<OsmPrimitiveType, Map<Long, Long>> newIds = new EnumMap<>(OsmPrimitiveType.class);
-        newIds.put(OsmPrimitiveType.NODE, new HashMap<Long, Long>());
-        newIds.put(OsmPrimitiveType.WAY, new HashMap<Long, Long>());
-        newIds.put(OsmPrimitiveType.RELATION, new HashMap<Long, Long>());
+        newIds.put(OsmPrimitiveType.NODE, new HashMap<>());
+        newIds.put(OsmPrimitiveType.WAY, new HashMap<>());
+        newIds.put(OsmPrimitiveType.RELATION, new HashMap<>());
 
         for (PrimitiveData data : pasteBuffer.getAll()) {
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 19101)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.dialogs;
 
+import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
 import static org.openstreetmap.josm.tools.I18n.trn;
@@ -94,4 +95,6 @@
  */
 public class SelectionListDialog extends ToggleDialog {
+    private static final String SELECTION_CASING = marktr("Selection");
+    private static final String SELECTION = "selection";
     private JList<OsmPrimitive> lstPrimitives;
     private final DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
@@ -147,7 +150,7 @@
      */
     public SelectionListDialog() {
-        super(tr("Selection"), "selectionlist", tr("Open a selection list window."),
+        super(tr(SELECTION_CASING), "selectionlist", tr("Open a selection list window."),
                 Shortcut.registerShortcut("subwindow:selection", tr("Windows: {0}",
-                tr("Selection")), KeyEvent.VK_T, Shortcut.ALT_SHIFT),
+                tr(SELECTION_CASING)), KeyEvent.VK_T, Shortcut.ALT_SHIFT),
                 150, // default height
                 true // default is "show dialog"
@@ -395,5 +398,5 @@
             putValue(NAME, tr("Zoom to selection"));
             putValue(SHORT_DESCRIPTION, tr("Zoom to selection"));
-            new ImageProvider("dialogs/autoscale", "selection").getResource().attachImageIcon(this, true);
+            new ImageProvider("dialogs/autoscale", SELECTION).getResource().attachImageIcon(this, true);
             updateEnabledState();
         }
@@ -434,5 +437,5 @@
          */
         ZoomToListSelection() {
-            new ImageProvider("dialogs/autoscale", "selection").getResource().attachImageIcon(this, true);
+            new ImageProvider("dialogs/autoscale", SELECTION).getResource().attachImageIcon(this, true);
             updateEnabledState();
         }
@@ -464,5 +467,5 @@
     /**
      * The list model for the list of OSM primitives in the current JOSM selection.
-     *
+     * <p>
      * The model also maintains a history of the last {@link SelectionListModel#SELECTION_HISTORY_SIZE}
      * JOSM selection.
@@ -493,5 +496,5 @@
          */
         public synchronized String getJOSMSelectionSummary() {
-            if (selection.isEmpty()) return tr("Selection");
+            if (selection.isEmpty()) return tr(SELECTION_CASING);
             int numNodes = 0;
             int numWays = 0;
@@ -650,5 +653,5 @@
                             : OsmPrimitiveComparator.comparingNames()));
                 } catch (IllegalArgumentException e) {
-                    throw BugReport.intercept(e).put("size", size).put("quick", quick).put("selection", selection);
+                    throw BugReport.intercept(e).put("size", size).put("quick", quick).put(SELECTION, selection);
                 }
             }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/BooleanStyleSettingGui.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/BooleanStyleSettingGui.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/BooleanStyleSettingGui.java	(revision 19101)
@@ -3,5 +3,5 @@
 
 import java.awt.event.ActionEvent;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.Objects;
 
@@ -40,5 +40,5 @@
                     setting.setValue(isSelected());
                     if (!noRepaint) {
-                        MainApplication.worker.submit(new MapPaintStyleLoader(Arrays.asList(setting.parentStyle)));
+                        MainApplication.worker.submit(new MapPaintStyleLoader(Collections.singletonList(setting.parentStyle)));
                     }
                 }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSettingGroupGui.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSettingGroupGui.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSettingGroupGui.java	(revision 19101)
@@ -6,4 +6,5 @@
 import java.awt.event.ActionEvent;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
@@ -52,10 +53,10 @@
                 public void actionPerformed(ActionEvent e) {
                     List<BooleanStyleSettingCheckBoxMenuItem> items = Arrays.stream(submenu.getMenuComponents())
-                            .filter(c -> c instanceof BooleanStyleSettingCheckBoxMenuItem)
+                            .filter(BooleanStyleSettingCheckBoxMenuItem.class::isInstance)
                             .map(c -> (BooleanStyleSettingCheckBoxMenuItem) c)
                             .collect(Collectors.toList());
                     final boolean select = items.stream().anyMatch(cbi -> !cbi.isSelected());
                     items.stream().filter(cbi -> select != cbi.isSelected()).forEach(cbi -> cbi.doClickWithoutRepaint(0));
-                    MainApplication.worker.submit(new MapPaintStyleLoader(Arrays.asList(group.parentStyle)));
+                    MainApplication.worker.submit(new MapPaintStyleLoader(Collections.singletonList(group.parentStyle)));
                 }
             });
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java	(revision 19101)
@@ -169,5 +169,5 @@
         /* Is joining an array really that complicated in Java? */
         private static String[] getDefaultNameTags() {
-            final var tags = new ArrayList<>(Arrays.asList(LanguageInfo.getOSMLocaleCodes("name:")));
+            final ArrayList<String> tags = new ArrayList<>(Arrays.asList(LanguageInfo.getOSMLocaleCodes("name:")));
             tags.addAll(Arrays.asList("name",
                     "int_name",
Index: trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java	(revision 19101)
@@ -59,4 +59,5 @@
 import javax.swing.KeyStroke;
 import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
 import javax.swing.UIManager;
 import javax.swing.event.CellEditorListener;
@@ -112,4 +113,6 @@
  */
 public abstract class SourceEditor extends JPanel {
+    private static final String DELETE = "delete";
+    private static final String DIALOGS = "dialogs";
 
     /** the type of source entry **/
@@ -219,6 +222,6 @@
         RemoveActiveSourcesAction removeActiveSourcesAction = new RemoveActiveSourcesAction();
         tblActiveSources.getSelectionModel().addListSelectionListener(removeActiveSourcesAction);
-        tblActiveSources.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete");
-        tblActiveSources.getActionMap().put("delete", removeActiveSourcesAction);
+        tblActiveSources.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DELETE);
+        tblActiveSources.getActionMap().put(DELETE, removeActiveSourcesAction);
 
         MoveUpDownAction moveUp = null;
@@ -297,5 +300,5 @@
         gbc.insets = new Insets(0, 0, 0, 6);
 
-        JToolBar sideButtonTB = new JToolBar(JToolBar.VERTICAL);
+        JToolBar sideButtonTB = new JToolBar(SwingConstants.VERTICAL);
         sideButtonTB.setFloatable(false);
         sideButtonTB.setBorderPainted(false);
@@ -363,6 +366,6 @@
         RemoveIconPathAction removeIconPathAction = new RemoveIconPathAction();
         tblIconPaths.getSelectionModel().addListSelectionListener(removeIconPathAction);
-        tblIconPaths.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete");
-        tblIconPaths.getActionMap().put("delete", removeIconPathAction);
+        tblIconPaths.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DELETE);
+        tblIconPaths.getActionMap().put(DELETE, removeIconPathAction);
 
         gbc.gridx = 0;
@@ -721,5 +724,5 @@
             data = IntStream.range(0, data.size())
                     .filter(i -> !idxs.contains(i))
-                    .mapToObj(i -> data.get(i))
+                    .mapToObj(data::get)
                     .collect(Collectors.toList());
             fireTableDataChanged();
@@ -909,5 +912,5 @@
             putValue(NAME, tr("New"));
             putValue(SHORT_DESCRIPTION, getStr(I18nString.NEW_SOURCE_ENTRY_TOOLTIP));
-            new ImageProvider("dialogs", "add").getResource().attachImageIcon(this);
+            new ImageProvider(DIALOGS, "add").getResource().attachImageIcon(this);
         }
 
@@ -939,5 +942,5 @@
             putValue(NAME, tr("Remove"));
             putValue(SHORT_DESCRIPTION, getStr(I18nString.REMOVE_SOURCE_TOOLTIP));
-            new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this);
+            new ImageProvider(DIALOGS, DELETE).getResource().attachImageIcon(this);
             updateEnabledState();
         }
@@ -962,5 +965,5 @@
             putValue(NAME, tr("Edit"));
             putValue(SHORT_DESCRIPTION, getStr(I18nString.EDIT_SOURCE_TOOLTIP));
-            new ImageProvider("dialogs", "edit").getResource().attachImageIcon(this);
+            new ImageProvider(DIALOGS, "edit").getResource().attachImageIcon(this);
             updateEnabledState();
         }
@@ -1008,5 +1011,5 @@
         MoveUpDownAction(boolean isDown) {
             increment = isDown ? 1 : -1;
-            new ImageProvider("dialogs", isDown ? "down" : "up").getResource().attachImageIcon(this, true);
+            new ImageProvider(DIALOGS, isDown ? "down" : "up").getResource().attachImageIcon(this, true);
             putValue(SHORT_DESCRIPTION, isDown ? tr("Move the selected entry one row down.") : tr("Move the selected entry one row up."));
             updateEnabledState();
@@ -1110,5 +1113,5 @@
             putValue(NAME, tr("Reload"));
             putValue(SHORT_DESCRIPTION, tr(getStr(I18nString.RELOAD_ALL_AVAILABLE), url));
-            new ImageProvider("dialogs", "refresh").getResource().attachImageIcon(this);
+            new ImageProvider(DIALOGS, "refresh").getResource().attachImageIcon(this);
             this.url = url;
             this.sourceProviders = sourceProviders;
@@ -1252,5 +1255,5 @@
             putValue(NAME, tr("New"));
             putValue(SHORT_DESCRIPTION, tr("Add a new icon path"));
-            new ImageProvider("dialogs", "add").getResource().attachImageIcon(this);
+            new ImageProvider(DIALOGS, "add").getResource().attachImageIcon(this);
         }
 
@@ -1266,5 +1269,5 @@
             putValue(NAME, tr("Remove"));
             putValue(SHORT_DESCRIPTION, tr("Remove the selected icon paths"));
-            new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this);
+            new ImageProvider(DIALOGS, DELETE).getResource().attachImageIcon(this);
             updateEnabledState();
         }
@@ -1289,5 +1292,5 @@
             putValue(NAME, tr("Edit"));
             putValue(SHORT_DESCRIPTION, tr("Edit the selected icon path"));
-            new ImageProvider("dialogs", "edit").getResource().attachImageIcon(this);
+            new ImageProvider(DIALOGS, "edit").getResource().attachImageIcon(this);
             updateEnabledState();
         }
@@ -1608,9 +1611,5 @@
         public void setInitialValue(String initialValue) {
             this.value = initialValue;
-            if (initialValue == null) {
-                this.tfFileName.setText("");
-            } else {
-                this.tfFileName.setText(initialValue);
-            }
+            this.tfFileName.setText(Objects.requireNonNullElse(initialValue, ""));
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 19101)
@@ -98,4 +98,6 @@
 
     private static final String EMPTY_TOOLBAR_MARKER = "<!-empty-!>";
+    private static final String TOOLBAR = "toolbar";
+    private static final String DIALOGS = "dialogs";
 
     /**
@@ -363,5 +365,5 @@
             result.setLength(0);
 
-            String val = (String) action.getAction().getValue("toolbar");
+            String val = (String) action.getAction().getValue(TOOLBAR);
             if (val == null)
                 return null;
@@ -395,6 +397,6 @@
                 tmp = action.getIcon();
                 if (!tmp.isEmpty()) {
-                    result.append(first ? "{" : ",");
-                    result.append("icon=");
+                    result.append(first ? "{" : ",")
+                            .append("icon=");
                     escape(tmp);
                     first = false;
@@ -513,5 +515,5 @@
                 // remove the button from toolbar preferences
                 t.remove(res);
-                Config.getPref().putList("toolbar", t);
+                Config.getPref().putList(TOOLBAR, t);
                 MainApplication.getToolbar().refreshToolbarControl();
             }
@@ -522,5 +524,5 @@
             public void actionPerformed(ActionEvent e) {
                 final PreferenceDialog p = new PreferenceDialog(MainApplication.getMainFrame());
-                SwingUtilities.invokeLater(() -> p.selectPreferencesTabByName("toolbar"));
+                SwingUtilities.invokeLater(() -> p.selectPreferencesTabByName(TOOLBAR));
                 p.setVisible(true);
             }
@@ -796,5 +798,5 @@
          */
         public Settings(DefaultMutableTreeNode rootActionsNode) {
-            super(/* ICON(preferences/) */ "toolbar", tr("Toolbar"), tr("Customize the elements on the toolbar."));
+            super(/* ICON(preferences/) */ TOOLBAR, tr("Toolbar"), tr("Customize the elements on the toolbar."));
             actionsTreeModel = new DefaultTreeModel(rootActionsNode);
             actionsTree = new JTree(actionsTreeModel);
@@ -805,9 +807,9 @@
             switch (name) {
                 case "up":
-                    b.setIcon(ImageProvider.get("dialogs", "up", ImageSizes.LARGEICON));
+                    b.setIcon(ImageProvider.get(DIALOGS, "up", ImageSizes.LARGEICON));
                     b.setToolTipText(tr("Move the currently selected members up"));
                     break;
                 case "down":
-                    b.setIcon(ImageProvider.get("dialogs", "down", ImageSizes.LARGEICON));
+                    b.setIcon(ImageProvider.get(DIALOGS, "down", ImageSizes.LARGEICON));
                     b.setToolTipText(tr("Move the currently selected members down"));
                     break;
@@ -817,5 +819,5 @@
                     break;
                 case ">":
-                    b.setIcon(ImageProvider.get("dialogs", "delete", ImageSizes.LARGEICON));
+                    b.setIcon(ImageProvider.get(DIALOGS, "delete", ImageSizes.LARGEICON));
                     b.setToolTipText(tr("Remove"));
                     break;
@@ -1014,5 +1016,5 @@
                 t = Collections.singletonList(EMPTY_TOOLBAR_MARKER);
             }
-            Config.getPref().putList("toolbar", t);
+            Config.getPref().putList(TOOLBAR, t);
             MainApplication.getToolbar().refreshToolbarControl();
             return false;
@@ -1050,5 +1052,5 @@
                     Action action = menuItem.getAction();
                     userObject = action;
-                    Object tb = action.getValue("toolbar");
+                    Object tb = action.getValue(TOOLBAR);
                     if (tb == null) {
                         Logging.info(tr("Toolbar action without name: {0}",
@@ -1101,5 +1103,5 @@
 
     public static Collection<String> getToolString() {
-        Collection<String> toolStr = Config.getPref().getList("toolbar", Arrays.asList(deftoolbar));
+        Collection<String> toolStr = Config.getPref().getList(TOOLBAR, Arrays.asList(deftoolbar));
         if (Utils.isEmpty(toolStr)) {
             toolStr = Arrays.asList(deftoolbar);
@@ -1141,5 +1143,5 @@
      */
     public Action register(Action action) {
-        String toolbar = (String) action.getValue("toolbar");
+        String toolbar = (String) action.getValue(TOOLBAR);
         if (toolbar == null) {
             Logging.info(tr("Registered toolbar action without name: {0}",
@@ -1165,5 +1167,5 @@
      */
     public Action unregister(Action action) {
-        Object toolbar = action.getValue("toolbar");
+        Object toolbar = action.getValue(TOOLBAR);
         if (toolbar instanceof String) {
             return regactions.remove(toolbar);
@@ -1243,5 +1245,5 @@
             }
         }
-        Config.getPref().putList("toolbar", t);
+        Config.getPref().putList(TOOLBAR, t);
         MainApplication.getToolbar().refreshToolbarControl();
     }
@@ -1273,5 +1275,5 @@
 
         if (sc == null || paramCode != 0) {
-            String name = Optional.ofNullable((String) action.getAction().getValue("toolbar")).orElseGet(action::getDisplayName);
+            String name = Optional.ofNullable((String) action.getAction().getValue(TOOLBAR)).orElseGet(action::getDisplayName);
             if (paramCode != 0) {
                 name = name+paramCode;
Index: trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(revision 19101)
@@ -11,4 +11,5 @@
 import java.awt.GridLayout;
 import java.awt.Toolkit;
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.awt.im.InputContext;
@@ -56,12 +57,12 @@
     // independent from the keyboard's labelling. But the operation system's locale
     // usually matches the keyboard. This even works with my English Windows and my German keyboard.
-    private static final String SHIFT = KeyEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
-            KeyEvent.SHIFT_DOWN_MASK).getModifiers());
-    private static final String CTRL = KeyEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
-            KeyEvent.CTRL_DOWN_MASK).getModifiers());
-    private static final String ALT = KeyEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
-            KeyEvent.ALT_DOWN_MASK).getModifiers());
-    private static final String META = KeyEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
-            KeyEvent.META_DOWN_MASK).getModifiers());
+    private static final String SHIFT = InputEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
+            InputEvent.SHIFT_DOWN_MASK).getModifiers());
+    private static final String CTRL = InputEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
+            InputEvent.CTRL_DOWN_MASK).getModifiers());
+    private static final String ALT = InputEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
+            InputEvent.ALT_DOWN_MASK).getModifiers());
+    private static final String META = InputEvent.getModifiersExText(KeyStroke.getKeyStroke(KeyEvent.VK_A,
+            InputEvent.META_DOWN_MASK).getModifiers());
 
     // A list of keys to present the user. Sadly this really is a list of keys Java knows about,
@@ -97,6 +98,6 @@
                     int i = field.getInt(null);
                     String s = KeyEvent.getKeyText(i);
-                    if (s != null && !s.isEmpty() && !s.contains(unknown)) {
-                        list.put(Integer.valueOf(i), s);
+                    if (!s.isEmpty() && !s.contains(unknown)) {
+                        list.put(i, s);
                     }
                 } catch (IllegalArgumentException | IllegalAccessException e) {
@@ -107,5 +108,5 @@
         KeyboardUtils.getExtendedKeyCodes(InputContext.getInstance().getLocale())
                 .forEach((key, value) -> list.put(key, value.toString()));
-        list.put(Integer.valueOf(-1), "");
+        list.put(-1, "");
 
         // Remove "look-alike" values. See JOSM #22020 comment 2. These override the standard left/right/up/down keys.
@@ -292,8 +293,8 @@
                 panel.cbDefault.setSelected(!sc.isAssignedUser());
                 panel.cbDisable.setSelected(sc.getKeyStroke() == null);
-                panel.cbShift.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & KeyEvent.SHIFT_DOWN_MASK) != 0);
-                panel.cbCtrl.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & KeyEvent.CTRL_DOWN_MASK) != 0);
-                panel.cbAlt.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & KeyEvent.ALT_DOWN_MASK) != 0);
-                panel.cbMeta.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & KeyEvent.META_DOWN_MASK) != 0);
+                panel.cbShift.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & InputEvent.SHIFT_DOWN_MASK) != 0);
+                panel.cbCtrl.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & InputEvent.CTRL_DOWN_MASK) != 0);
+                panel.cbAlt.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & InputEvent.ALT_DOWN_MASK) != 0);
+                panel.cbMeta.setSelected(sc.getAssignedModifier() != -1 && (sc.getAssignedModifier() & InputEvent.META_DOWN_MASK) != 0);
                 if (sc.getKeyStroke() != null) {
                     panel.tfKey.setSelectedItem(keyList.get(sc.getKeyStroke().getKeyCode()));
@@ -329,8 +330,8 @@
                     } else {
                         sc.setAssignedModifier(
-                                (panel.cbShift.isSelected() ? KeyEvent.SHIFT_DOWN_MASK : 0) |
-                                (panel.cbCtrl.isSelected() ? KeyEvent.CTRL_DOWN_MASK : 0) |
-                                (panel.cbAlt.isSelected() ? KeyEvent.ALT_DOWN_MASK : 0) |
-                                (panel.cbMeta.isSelected() ? KeyEvent.META_DOWN_MASK : 0)
+                                (panel.cbShift.isSelected() ? InputEvent.SHIFT_DOWN_MASK : 0) |
+                                (panel.cbCtrl.isSelected() ? InputEvent.CTRL_DOWN_MASK : 0) |
+                                (panel.cbAlt.isSelected() ? InputEvent.ALT_DOWN_MASK : 0) |
+                                (panel.cbMeta.isSelected() ? InputEvent.META_DOWN_MASK : 0)
                         );
                         for (Map.Entry<Integer, String> entry : keyList.entrySet()) {
Index: trunk/src/org/openstreetmap/josm/io/OnlineResource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OnlineResource.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/io/OnlineResource.java	(revision 19101)
@@ -36,5 +36,5 @@
      * @return the localized name
      */
-    public final String getLocName() {
+    public String getLocName() {
         return locName;
     }
@@ -45,5 +45,5 @@
      * @since 17041
      */
-    public final String getOfflineIcon() {
+    public String getOfflineIcon() {
         switch (this) {
             case OSM_API:
@@ -67,5 +67,5 @@
      * @return whether the given URL matches this online resource
      */
-    public final boolean matches(String url) {
+    public boolean matches(String url) {
         final String baseUrl;
         switch (this) {
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 19101)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.io;
 
+import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
 import static org.openstreetmap.josm.tools.I18n.trn;
@@ -64,4 +65,7 @@
  */
 public class OsmApi extends OsmConnection {
+    private static final String CHANGESET_STR = "changeset";
+    private static final String CHANGESET_SLASH = "changeset/";
+    private static final String ERROR_MESSAGE = marktr("Changeset ID > 0 expected. Got {0}.");
 
     /**
@@ -465,5 +469,5 @@
      */
     public void openChangeset(Changeset changeset, ProgressMonitor progressMonitor) throws OsmTransferException {
-        CheckParameterUtil.ensureParameterNotNull(changeset, "changeset");
+        CheckParameterUtil.ensureParameterNotNull(changeset, CHANGESET_STR);
         try {
             progressMonitor.beginTask(tr("Creating changeset..."));
@@ -496,15 +500,15 @@
      */
     public void updateChangeset(Changeset changeset, ProgressMonitor monitor) throws OsmTransferException {
-        CheckParameterUtil.ensureParameterNotNull(changeset, "changeset");
+        CheckParameterUtil.ensureParameterNotNull(changeset, CHANGESET_STR);
         if (monitor == null) {
             monitor = NullProgressMonitor.INSTANCE;
         }
         if (changeset.getId() <= 0)
-            throw new IllegalArgumentException(tr("Changeset ID > 0 expected. Got {0}.", changeset.getId()));
+            throw new IllegalArgumentException(tr(ERROR_MESSAGE, changeset.getId()));
         try {
             monitor.beginTask(tr("Updating changeset..."));
             initialize(monitor);
             monitor.setCustomText(tr("Updating changeset {0}...", changeset.getId()));
-            sendPutRequest("changeset/" + changeset.getId(), toXml(changeset), monitor);
+            sendPutRequest(CHANGESET_SLASH + changeset.getId(), toXml(changeset), monitor);
         } catch (ChangesetClosedException e) {
             e.setSource(ChangesetClosedException.Source.UPDATE_CHANGESET);
@@ -531,15 +535,15 @@
      */
     public void closeChangeset(Changeset changeset, ProgressMonitor monitor) throws OsmTransferException {
-        CheckParameterUtil.ensureParameterNotNull(changeset, "changeset");
+        CheckParameterUtil.ensureParameterNotNull(changeset, CHANGESET_STR);
         if (monitor == null) {
             monitor = NullProgressMonitor.INSTANCE;
         }
         if (changeset.getId() <= 0)
-            throw new IllegalArgumentException(tr("Changeset ID > 0 expected. Got {0}.", changeset.getId()));
+            throw new IllegalArgumentException(tr(ERROR_MESSAGE, changeset.getId()));
         try {
             monitor.beginTask(tr("Closing changeset..."));
             initialize(monitor);
             // send "\r\n" instead of empty string, so we don't send zero payload - workaround bugs in proxy software
-            sendPutRequest("changeset/" + changeset.getId() + "/close", "\r\n", monitor);
+            sendPutRequest(CHANGESET_SLASH + changeset.getId() + "/close", "\r\n", monitor);
         } catch (ChangesetClosedException e) {
             e.setSource(ChangesetClosedException.Source.CLOSE_CHANGESET);
@@ -565,6 +569,6 @@
             throw new IllegalArgumentException(tr("Changeset must be closed in order to add a comment"));
         else if (changeset.getId() <= 0)
-            throw new IllegalArgumentException(tr("Changeset ID > 0 expected. Got {0}.", changeset.getId()));
-        sendRequest("POST", "changeset/" + changeset.getId() + "/comment?text="+ Utils.encodeUrl(comment),
+            throw new IllegalArgumentException(tr(ERROR_MESSAGE, changeset.getId()));
+        sendRequest("POST", CHANGESET_SLASH + changeset.getId() + "/comment?text="+ Utils.encodeUrl(comment),
                 null, monitor, "application/x-www-form-urlencoded", true, false);
     }
@@ -599,5 +603,5 @@
             monitor.indeterminateSubTask(
                     trn("Uploading {0} object...", "Uploading {0} objects...", list.size(), list.size()));
-            String diffUploadResponse = sendPostRequest("changeset/" + changeset.getId() + "/upload", diffUploadRequest, monitor);
+            String diffUploadResponse = sendPostRequest(CHANGESET_SLASH + changeset.getId() + "/upload", diffUploadRequest, monitor);
 
             // Process the response from the server
@@ -893,5 +897,5 @@
         }
         if (changeset.getId() <= 0)
-            throw new IllegalArgumentException(tr("Changeset ID > 0 expected. Got {0}.", changeset.getId()));
+            throw new IllegalArgumentException(tr(ERROR_MESSAGE, changeset.getId()));
         if (!changeset.isOpen())
             throw new IllegalArgumentException(tr("Open changeset expected. Got closed changeset with id {0}.", changeset.getId()));
@@ -954,6 +958,6 @@
             .append("/close");
         if (!encodedMessage.trim().isEmpty()) {
-            urlBuilder.append("?text=");
-            urlBuilder.append(encodedMessage);
+            urlBuilder.append("?text=")
+                    .append(encodedMessage);
         }
 
@@ -975,6 +979,6 @@
             .append("/reopen");
         if (!encodedMessage.trim().isEmpty()) {
-            urlBuilder.append("?text=");
-            urlBuilder.append(encodedMessage);
+            urlBuilder.append("?text=")
+                    .append(encodedMessage);
         }
 
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 19101)
@@ -9,4 +9,5 @@
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
@@ -98,5 +99,5 @@
         int addValue(String val) {
             Integer c = valueCount.get(val);
-            int r = c == null ? 1 : (c.intValue()+1);
+            int r = c == null ? 1 : (c + 1);
             valueCount.put(val, r);
             return r;
@@ -138,6 +139,7 @@
             count[i] = 0;
             String key = tags[i][0];
-            String value = tags[i][1], oldValue;
-            Boolean b = Boolean.TRUE;
+            String value = tags[i][1];
+            String oldValue;
+            boolean b = Boolean.TRUE;
             ExistingValues old = new ExistingValues(key);
             for (OsmPrimitive osm : sel) {
@@ -204,5 +206,5 @@
         // get edit results if the table looses the focus, for example if a user clicks "add tags"
         propertyTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
-        propertyTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_DOWN_MASK), "shiftenter");
+        propertyTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK), "shiftenter");
         propertyTable.getActionMap().put("shiftenter", new AbstractAction() {
             @Override public void actionPerformed(ActionEvent e) {
@@ -242,5 +244,5 @@
             TableModel tm = propertyTable.getModel();
             for (int i = 0; i < tm.getRowCount(); i++) {
-                if (buttonIndex == 1 || (Boolean) tm.getValueAt(i, 0)) {
+                if (buttonIndex == 1 || Boolean.TRUE.equals(tm.getValueAt(i, 0))) {
                     String key = (String) tm.getValueAt(i, 1);
                     Object value = tm.getValueAt(i, 2);
Index: trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 19101)
@@ -90,4 +90,15 @@
  */
 public final class PluginHandler {
+    private static final String DIALOGS = "dialogs";
+    private static final String WARNING = marktr("Warning");
+    private static final String HTML_START = "<html>";
+    private static final String HTML_END = "</html>";
+    private static final String UPDATE_PLUGINS = marktr("Update plugins");
+    private static final String CANCEL = "cancel";
+    private static final String PLUGINS = "plugins";
+    private static final String DISABLE_PLUGIN = marktr("Disable plugin");
+    private static final String PLUGINMANAGER_VERSION_BASED_UPDATE_POLICY = "pluginmanager.version-based-update.policy";
+    private static final String PLUGINMANAGER_LASTUPDATE = "pluginmanager.lastupdate";
+    private static final String PLUGINMANAGER_TIME_BASED_UPDATE_POLICY = "pluginmanager.time-based-update.policy";
 
     /**
@@ -197,8 +208,8 @@
             sorted.putAll(info.attr);
             for (Entry<Object, Object> e : sorted.entrySet()) {
-                b.append(e.getKey());
-                b.append(": ");
-                b.append(e.getValue());
-                b.append('\n');
+                b.append(e.getKey())
+                        .append(": ")
+                        .append(e.getValue())
+                        .append('\n');
             }
             return b.toString();
@@ -275,5 +286,5 @@
      * List of unmaintained plugins. Not really up-to-date as the vast majority of plugins are not maintained after a few months, sadly...
      */
-    static final List<String> UNMAINTAINED_PLUGINS = Collections.unmodifiableList(Arrays.asList(
+    static final List<String> UNMAINTAINED_PLUGINS = List.of(
         "irsrectify", // See https://josm.openstreetmap.de/changeset/29404/osm/
         "surveyor2", // See https://josm.openstreetmap.de/changeset/29404/osm/
@@ -283,5 +294,5 @@
         "LaneConnector",           // See #11468, #11518, https://github.com/TrifanAdrian/LanecConnectorPlugin/issues/1
         "Remove.redundant.points"  // See #11468, #11518, https://github.com/bularcasergiu/RemoveRedundantPoints (not even created an issue...)
-    ));
+    );
 
     /**
@@ -385,5 +396,5 @@
             if (plugins.contains(depr.name)) {
                 plugins.remove(depr.name);
-                PreferencesUtils.removeFromList(Config.getPref(), "plugins", depr.name);
+                PreferencesUtils.removeFromList(Config.getPref(), PLUGINS, depr.name);
                 removedPlugins.add(depr);
             }
@@ -397,5 +408,5 @@
                 parent,
                 getRemovedPluginsMessage(removedPlugins),
-                tr("Warning"),
+                tr(WARNING),
                 JOptionPane.WARNING_MESSAGE
         );
@@ -404,5 +415,5 @@
     static String getRemovedPluginsMessage(Collection<DeprecatedPlugin> removedPlugins) {
         StringBuilder sb = new StringBuilder(32);
-        sb.append("<html>")
+        sb.append(HTML_START)
           .append(trn(
                 "The following plugin is no longer necessary and has been deactivated:",
@@ -417,5 +428,5 @@
             sb.append("</li>");
         }
-        sb.append("</ul></html>");
+        sb.append("</ul>").append(HTML_END);
         return sb.toString();
     }
@@ -437,5 +448,5 @@
             }
             if (confirmDisablePlugin(parent, getUnmaintainedPluginMessage(unmaintained), unmaintained)) {
-                PreferencesUtils.removeFromList(Config.getPref(), "plugins", unmaintained);
+                PreferencesUtils.removeFromList(Config.getPref(), PLUGINS, unmaintained);
                 plugins.remove(unmaintained);
             }
@@ -470,24 +481,24 @@
         if (Config.getPref().getInt("pluginmanager.version", 0) < v) {
             message =
-                "<html>"
+                HTML_START
                 + tr("You updated your JOSM software.<br>"
                         + "To prevent problems the plugins should be updated as well.<br><br>"
                         + "Update plugins now?"
                 )
-                + "</html>";
-            togglePreferenceKey = "pluginmanager.version-based-update.policy";
+                + HTML_END;
+            togglePreferenceKey = PLUGINMANAGER_VERSION_BASED_UPDATE_POLICY;
         } else {
             long tim = System.currentTimeMillis();
-            long last = Config.getPref().getLong("pluginmanager.lastupdate", 0);
+            long last = Config.getPref().getLong(PLUGINMANAGER_LASTUPDATE, 0);
             int maxTime = Config.getPref().getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL);
             long d = TimeUnit.MILLISECONDS.toDays(tim - last);
             if ((last <= 0) || (maxTime <= 0)) {
-                Config.getPref().put("pluginmanager.lastupdate", Long.toString(tim));
+                Config.getPref().put(PLUGINMANAGER_LASTUPDATE, Long.toString(tim));
             } else if (d > maxTime) {
                 message =
-                    "<html>"
+                    HTML_START
                     + tr("Last plugin update more than {0} days ago.", d)
-                    + "</html>";
-                togglePreferenceKey = "pluginmanager.time-based-update.policy";
+                    + HTML_END;
+                togglePreferenceKey = PLUGINMANAGER_TIME_BASED_UPDATE_POLICY;
             }
         }
@@ -503,7 +514,7 @@
         switch (policy) {
         case "never":
-            if ("pluginmanager.version-based-update.policy".equals(togglePreferenceKey)) {
+            if (PLUGINMANAGER_VERSION_BASED_UPDATE_POLICY.equals(togglePreferenceKey)) {
                 Logging.info(tr("Skipping plugin update after JOSM upgrade. Automatic update at startup is disabled."));
-            } else if ("pluginmanager.time-based-update.policy".equals(togglePreferenceKey)) {
+            } else if (PLUGINMANAGER_TIME_BASED_UPDATE_POLICY.equals(togglePreferenceKey)) {
                 Logging.info(tr("Skipping plugin update after elapsed update interval. Automatic update at startup is disabled."));
             }
@@ -511,7 +522,7 @@
 
         case "always":
-            if ("pluginmanager.version-based-update.policy".equals(togglePreferenceKey)) {
+            if (PLUGINMANAGER_VERSION_BASED_UPDATE_POLICY.equals(togglePreferenceKey)) {
                 Logging.info(tr("Running plugin update after JOSM upgrade. Automatic update at startup is enabled."));
-            } else if ("pluginmanager.time-based-update.policy".equals(togglePreferenceKey)) {
+            } else if (PLUGINMANAGER_TIME_BASED_UPDATE_POLICY.equals(togglePreferenceKey)) {
                 Logging.info(tr("Running plugin update after elapsed update interval. Automatic update at startup is disabled."));
             }
@@ -527,6 +538,6 @@
         ButtonSpec[] options = {
                 new ButtonSpec(
-                        tr("Update plugins"),
-                        new ImageProvider("dialogs", "refresh"),
+                        tr(UPDATE_PLUGINS),
+                        new ImageProvider(DIALOGS, "refresh"),
                         tr("Click to update the activated plugins"),
                         null /* no specific help context */
@@ -534,5 +545,5 @@
                 new ButtonSpec(
                         tr("Skip update"),
-                        new ImageProvider("cancel"),
+                        new ImageProvider(CANCEL),
                         tr("Click to skip updating the activated plugins"),
                         null /* no specific help context */
@@ -543,5 +554,5 @@
                 parent,
                 pnlMessage,
-                tr("Update plugins"),
+                tr(UPDATE_PLUGINS),
                 JOptionPane.WARNING_MESSAGE,
                 null,
@@ -577,5 +588,5 @@
     private static void alertMissingRequiredPlugin(Component parent, String plugin, Set<String> missingRequiredPlugin) {
         StringBuilder sb = new StringBuilder(48);
-        sb.append("<html>")
+        sb.append(HTML_START)
           .append(trn("Plugin {0} requires a plugin which was not found. The missing plugin is:",
                 "Plugin {0} requires {1} plugins which were not found. The missing plugins are:",
@@ -584,5 +595,5 @@
                 missingRequiredPlugin.size()))
           .append(Utils.joinAsHtmlUnorderedList(missingRequiredPlugin))
-          .append("</html>");
+          .append(HTML_END);
         ButtonSpec[] specs = {
                 new ButtonSpec(
@@ -636,9 +647,9 @@
                     if (!task.getDownloadedPlugins().isEmpty()) {
                         // update plugin list in preferences
-                        Set<String> plugins = new HashSet<>(Config.getPref().getList("plugins"));
+                        Set<String> plugins = new HashSet<>(Config.getPref().getList(PLUGINS));
                         for (PluginInformation plugin : task.getDownloadedPlugins()) {
                             plugins.add(plugin.name);
                         }
-                        Config.getPref().putList("plugins", new ArrayList<>(plugins));
+                        Config.getPref().putList(PLUGINS, new ArrayList<>(plugins));
                         // restart
                         RestartAction.restartJOSM();
@@ -667,9 +678,9 @@
         final int selected = HelpAwareOptionPane.showOptionDialog(
                 parent,
-                "<html>" + tr("Plugin {0} requires Java version {1}. The current Java version is {2}.<br>"
+                HTML_START + tr("Plugin {0} requires Java version {1}. The current Java version is {2}.<br>"
                                 + "You have to update Java in order to use this plugin.",
                         plugin, Integer.toString(requiredVersion), Utils.getJavaVersion()
-                ) + "</html>",
-                tr("Warning"),
+                ) + HTML_END,
+                tr(WARNING),
                 JOptionPane.WARNING_MESSAGE,
                 null,
@@ -678,11 +689,7 @@
                 null
         );
-        if (selected == 1) {
-            if (Utils.isRunningJavaWebStart()) {
-                OpenBrowser.displayUrl(Config.getPref().get("openwebstart.download.url", "https://openwebstart.com/download/"));
-            } else if (!Utils.isRunningWebStart()) {
-                final String javaUrl = PlatformManager.getPlatform().getJavaUrl();
-                OpenBrowser.displayUrl(javaUrl);
-            }
+        if (selected == 1 && !Utils.isRunningWebStart()) {
+            final String javaUrl = PlatformManager.getPlatform().getJavaUrl();
+            OpenBrowser.displayUrl(javaUrl);
         }
     }
@@ -695,5 +702,5 @@
                         plugin, Integer.toString(requiredVersion), Version.getInstance().getVersionString()
                 ),
-                tr("Warning"),
+                tr(WARNING),
                 JOptionPane.WARNING_MESSAGE,
                 null
@@ -861,5 +868,5 @@
         }
         if (msg != null && confirmDisablePlugin(parent, msg, plugin.name)) {
-            PreferencesUtils.removeFromList(Config.getPref(), "plugins", plugin.name);
+            PreferencesUtils.removeFromList(Config.getPref(), PLUGINS, plugin.name);
         }
     }
@@ -1021,5 +1028,5 @@
     private static void alertMissingPluginInformation(Component parent, Collection<String> plugins) {
         StringBuilder sb = new StringBuilder();
-        sb.append("<html>")
+        sb.append(HTML_START)
           .append(trn("JOSM could not find information about the following plugin:",
                 "JOSM could not find information about the following plugins:",
@@ -1029,9 +1036,9 @@
                 "The plugins are not going to be loaded.",
                 plugins.size()))
-          .append("</html>");
+          .append(HTML_END);
         HelpAwareOptionPane.showOptionDialog(
                 parent,
                 sb.toString(),
-                tr("Warning"),
+                tr(WARNING),
                 JOptionPane.WARNING_MESSAGE,
                 ht("/Plugin/Loading#MissingPluginInfos")
@@ -1054,5 +1061,5 @@
         try {
             monitor.beginTask(tr("Determining plugins to load..."));
-            Set<String> plugins = new HashSet<>(Config.getPref().getList("plugins", new LinkedList<>()));
+            Set<String> plugins = new HashSet<>(Config.getPref().getList(PLUGINS, new LinkedList<>()));
             Logging.debug("Plugins list initialized to {0}", plugins);
             String systemProp = Utils.getSystemProperty("josm.plugins");
@@ -1088,5 +1095,5 @@
     private static void alertFailedPluginUpdate(Component parent, Collection<PluginInformation> plugins) {
         StringBuilder sb = new StringBuilder(128);
-        sb.append("<html>")
+        sb.append(HTML_START)
           .append(trn(
                 "Updating the following plugin has failed:",
@@ -1102,5 +1109,5 @@
                 "Please open the Preference Dialog after JOSM has started and try to update them manually.",
                 plugins.size()))
-          .append("</html>");
+          .append(HTML_END);
         HelpAwareOptionPane.showOptionDialog(
                 parent,
@@ -1222,5 +1229,5 @@
                         monitor.createSubTaskMonitor(1, false),
                         pluginsToDownload,
-                        tr("Update plugins")
+                        tr(UPDATE_PLUGINS)
                         );
                 future = MainApplication.worker.submit(pluginDownloadTask);
@@ -1254,5 +1261,5 @@
             // if all plugins updated, remember the update because it was successful
             Config.getPref().putInt("pluginmanager.version", Version.getInstance().getVersion());
-            Config.getPref().put("pluginmanager.lastupdate", Long.toString(System.currentTimeMillis()));
+            Config.getPref().put(PLUGINMANAGER_LASTUPDATE, Long.toString(System.currentTimeMillis()));
         }
         return plugins;
@@ -1270,6 +1277,6 @@
         ButtonSpec[] options = {
                 new ButtonSpec(
-                        tr("Disable plugin"),
-                        new ImageProvider("dialogs", "delete"),
+                        tr(DISABLE_PLUGIN),
+                        new ImageProvider(DIALOGS, "delete"),
                         tr("Click to delete the plugin ''{0}''", name),
                         null /* no specific help context */
@@ -1277,5 +1284,5 @@
                 new ButtonSpec(
                         tr("Keep plugin"),
-                        new ImageProvider("cancel"),
+                        new ImageProvider(CANCEL),
                         tr("Click to keep the plugin ''{0}''", name),
                         null /* no specific help context */
@@ -1285,5 +1292,5 @@
                     parent,
                     reason,
-                    tr("Disable plugin"),
+                    tr(DISABLE_PLUGIN),
                     JOptionPane.WARNING_MESSAGE,
                     null,
@@ -1484,11 +1491,11 @@
                 new ButtonSpec(
                         tr("Update plugin"),
-                        new ImageProvider("dialogs", "refresh"),
+                        new ImageProvider(DIALOGS, "refresh"),
                         tr("Click to update the plugin ''{0}''", plugin.getPluginInformation().name),
                         null /* no specific help context */
                 ),
                 new ButtonSpec(
-                        tr("Disable plugin"),
-                        new ImageProvider("dialogs", "delete"),
+                        tr(DISABLE_PLUGIN),
+                        new ImageProvider(DIALOGS, "delete"),
                         tr("Click to disable the plugin ''{0}''", plugin.getPluginInformation().name),
                         null /* no specific help context */
@@ -1496,5 +1503,5 @@
                 new ButtonSpec(
                         tr("Keep plugin"),
-                        new ImageProvider("cancel"),
+                        new ImageProvider(CANCEL),
                         tr("Click to keep the plugin ''{0}''", plugin.getPluginInformation().name),
                         null /* no specific help context */
@@ -1503,5 +1510,5 @@
 
         final StringBuilder msg = new StringBuilder(256);
-        msg.append("<html>")
+        msg.append(HTML_START)
            .append(tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.",
                    Utils.escapeReservedCharactersHTML(plugin.getPluginInformation().name)))
@@ -1513,5 +1520,5 @@
         }
         msg.append(tr("Try updating to the newest version of this plugin before reporting a bug."))
-           .append("</html>");
+           .append(HTML_END);
 
         try {
@@ -1519,5 +1526,5 @@
                     MainApplication.getMainFrame(),
                     msg.toString(),
-                    tr("Update plugins"),
+                    tr(UPDATE_PLUGINS),
                     JOptionPane.QUESTION_MESSAGE,
                     null,
@@ -1590,5 +1597,5 @@
             return null;
 
-        Set<String> plugins = new HashSet<>(Config.getPref().getList("plugins"));
+        Set<String> plugins = new HashSet<>(Config.getPref().getList(PLUGINS));
         final PluginInformation pluginInfo = plugin.getPluginInformation();
         if (!plugins.contains(pluginInfo.name))
@@ -1605,5 +1612,5 @@
             // deactivate the plugin
             plugins.remove(plugin.getPluginInformation().name);
-            Config.getPref().putList("plugins", new ArrayList<>(plugins));
+            Config.getPref().putList(PLUGINS, new ArrayList<>(plugins));
             GuiHelper.runInEDTAndWait(() -> JOptionPane.showMessageDialog(
                     MainApplication.getMainFrame(),
@@ -1624,5 +1631,5 @@
      */
     public static Collection<String> getBugReportInformation() {
-        final Collection<String> pl = new TreeSet<>(Config.getPref().getList("plugins", new LinkedList<>()));
+        final Collection<String> pl = new TreeSet<>(Config.getPref().getList(PLUGINS, new LinkedList<>()));
         for (final PluginProxy pp : pluginList) {
             PluginInformation pi = pp.getPluginInformation();
Index: trunk/src/org/openstreetmap/josm/tools/Diff.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Diff.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/Diff.java	(revision 19101)
@@ -104,5 +104,7 @@
     private int equivMax = 1;
 
-    private int[] xvec, yvec; /* Vectors being compared. */
+    /* Vectors being compared. */
+    private int[] xvec;
+    private int[] yvec;
     private int[] fdiag;      /* Vector, indexed by diagonal, containing
                    the X coordinate of the point furthest
@@ -113,5 +115,6 @@
                    along the given diagonal in the backward
                    search of the edit matrix. */
-    private int fdiagoff, bdiagoff;
+    private int fdiagoff;
+    private int bdiagoff;
     private final FileData[] filevec;
     private int cost;
@@ -120,10 +123,10 @@
      * Find the midpoint of the shortest edit script for a specified
      * portion of the two files.
-     *
+     * <p>
      * We scan from the beginnings of the files, and simultaneously from the ends,
      * doing a breadth-first search through the space of edit-sequence.
      * When the two searches meet, we have found the midpoint of the shortest
      * edit sequence.
-     *
+     * <p>
      * The value returned is the number of the diagonal on which the midpoint lies.
      * The diagonal number equals the number of inserted lines minus the number
@@ -131,10 +134,10 @@
      * The edit cost is stored into COST; this is the total number of
      * lines inserted or deleted (counting only lines before the midpoint).
-     *
+     * <p>
      * This function assumes that the first lines of the specified portions
      * of the two files do not match, and likewise that the last lines do not
      * match.  The caller must trim matching lines from the beginning and end
      * of the portions it is going to specify.
-     *
+     * <p>
      * Note that if we return the "wrong" diagonal value, or if
      * the value of bdiag at that diagonal is "wrong",
@@ -156,6 +159,10 @@
         final int fmid = xoff - yoff;   // Center diagonal of top-down search.
         final int bmid = xlim - ylim;   // Center diagonal of bottom-up search.
-        int fmin = fmid, fmax = fmid;   // Limits of top-down search.
-        int bmin = bmid, bmax = bmid;   // Limits of bottom-up search.
+        // Limits of top-down search.
+        int fmin = fmid;
+        int fmax = fmid;
+        // Limits of bottom-up search.
+        int bmin = bmid;
+        int bmax = bmid;
         // True if southeast corner is on an odd diagonal with respect to the northwest.
         final boolean odd = (fmid - bmid & 1) != 0;
@@ -212,5 +219,8 @@
             }
             for (d = bmax; d >= bmin; d -= 2) {
-                int x, y, tlo = bd[bdiagoff + d - 1], thi = bd[bdiagoff + d + 1];
+                int x;
+                int y;
+                final int tlo = bd[bdiagoff + d - 1];
+                final int thi = bd[bdiagoff + d + 1];
 
                 if (tlo < thi) {
@@ -235,10 +245,10 @@
      * Compare in detail contiguous subsequences of the two files
      * which are known, as a whole, to match each other.
-     *
+     * <p>
      * The results are recorded in the vectors filevec[N].changed_flag, by
      * storing a 1 in the element for each line that is an insertion or deletion.
-     *
+     * <p>
      * The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
-     *
+     * <p>
      * Note that XLIM, YLIM are exclusive bounds.
      * All line numbers are origin-0 and discarded lines are not counted.
@@ -340,5 +350,6 @@
             while (i0 < len0 || i1 < len1) {
                 if (changed0[1+i0] || changed1[1+i1]) {
-                    int line0 = i0, line1 = i1;
+                    int line0 = i0;
+                    int line1 = i1;
 
                     /* Find # lines changed here in each file.  */
@@ -374,5 +385,6 @@
             while (i0 >= 0 || i1 >= 0) {
                 if (changed0[i0] || changed1[i1]) {
-                    int line0 = i0, line1 = i1;
+                    int line0 = i0;
+                    int line1 = i1;
 
                     /* Find # lines changed here in each file.  */
@@ -480,5 +492,5 @@
          * DELETED is the number of lines deleted here from file 0.
          * INSERTED is the number of lines inserted here in file 1.
-         *
+         * <p>
          * If DELETED is 0 then LINE0 is the number of the line before
          * which the insertion was done; vice versa for INSERTED and LINE1.
@@ -539,5 +551,5 @@
         /**
          * Discard lines that have no matches in another file.
-         *
+         * <p>
          * A line which is discarded will not be considered by the actual comparison algorithm;
          * it will be as if that line were not in the file.
@@ -747,5 +759,5 @@
                     h.put(data[i], equivs[i]);
                 } else {
-                    equivs[i] = ir.intValue();
+                    equivs[i] = ir;
                 }
             }
@@ -754,5 +766,5 @@
         /**
          * Adjust inserts/deletes of blank lines to join changes as much as possible.
-         *
+         * <p>
          * We do something when a run of changed lines include a blank line at one end and have an excluded blank line at the other.
          * We are free to choose which blank line is included.
Index: trunk/src/org/openstreetmap/josm/tools/ExifReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ExifReader.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/ExifReader.java	(revision 19101)
@@ -23,5 +23,4 @@
 import com.drew.metadata.exif.ExifDirectoryBase;
 import com.drew.metadata.exif.ExifIFD0Directory;
-import com.drew.metadata.exif.ExifSubIFDDirectory;
 import com.drew.metadata.exif.GpsDirectory;
 import com.drew.metadata.iptc.IptcDirectory;
@@ -76,16 +75,16 @@
                 }
                 for (Tag tag : dirIt.getTags()) {
-                    if (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL /* 0x9003 */ &&
-                            !tag.getDescription().matches("\\[[0-9]+ .+\\]")) {
+                    if (tag.getTagType() == ExifDirectoryBase.TAG_DATETIME_ORIGINAL /* 0x9003 */ &&
+                            !tag.getDescription().matches("\\[\\d+ .+]")) {
                         dateTimeOrig = tag.getDescription();
-                    } else if (tag.getTagType() == ExifIFD0Directory.TAG_DATETIME /* 0x0132 */) {
+                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_DATETIME /* 0x0132 */) {
                         dateTime = tag.getDescription();
-                    } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
+                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
                         dateTimeDig = tag.getDescription();
-                    } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_SUBSECOND_TIME_ORIGINAL /* 0x9291 */) {
+                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_SUBSECOND_TIME_ORIGINAL /* 0x9291 */) {
                         subSecOrig = tag.getDescription();
-                    } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_SUBSECOND_TIME /* 0x9290 */) {
+                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_SUBSECOND_TIME /* 0x9290 */) {
                         subSec = tag.getDescription();
-                    } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_SUBSECOND_TIME_DIGITIZED /* 0x9292 */) {
+                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_SUBSECOND_TIME_DIGITIZED /* 0x9292 */) {
                         subSecDig = tag.getDescription();
                     }
@@ -145,5 +144,5 @@
             final Metadata metadata = JpegMetadataReader.readMetadata(filename);
             final Directory dir = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
-            return dir == null ? null : dir.getInteger(ExifIFD0Directory.TAG_ORIENTATION);
+            return dir == null ? null : dir.getInteger(ExifDirectoryBase.TAG_ORIENTATION);
         } catch (JpegProcessingException | IOException e) {
             Logging.error(e);
@@ -316,5 +315,5 @@
             if (ele != null) {
                 final Integer d = dirGps.getInteger(GpsDirectory.TAG_ALTITUDE_REF);
-                if (d != null && d.intValue() == 1) {
+                if (d != null && d == 1) {
                     ele *= -1;
                 }
@@ -367,5 +366,5 @@
     /**
      * Returns a Transform that fixes the image orientation.
-     *
+     * <p>
      * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated as 1.
      * @param orientation the exif-orientation of the image
@@ -376,5 +375,6 @@
     public static AffineTransform getRestoreOrientationTransform(final int orientation, final int width, final int height) {
         final int q;
-        final double ax, ay;
+        final double ax;
+        final double ay;
         switch (orientation) {
         case 8:
@@ -404,5 +404,5 @@
      * Check, if the given orientation switches width and height of the image.
      * E.g. 90 degree rotation
-     *
+     * <p>
      * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated
      * as 1.
@@ -416,5 +416,5 @@
     /**
      * Check, if the given orientation requires any correction to the image.
-     *
+     * <p>
      * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated
      * as 1.
Index: trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java	(revision 19101)
@@ -96,5 +96,5 @@
         } else if (code.matches(".+@.+")) {
             return code.substring(0, 1).toUpperCase(Locale.ENGLISH)
-                    + code.substring(1, 2)
+                    + code.charAt(1)
                     + '-'
                     + code.substring(3, 4).toUpperCase(Locale.ENGLISH)
@@ -128,9 +128,9 @@
     /**
      * Replies the locale code used by JOSM for a given locale.
-     *
+     * <p>
      * In most cases JOSM uses the 2-character ISO 639 language code ({@link Locale#getLanguage()}
      * to identify the locale of a localized resource, but in some cases it may use the
      * programmatic name for locales, as replied by {@link Locale#toString()}.
-     *
+     * <p>
      * For unknown country codes and variants this function already does fallback to
      * internally known translations.
@@ -157,4 +157,5 @@
      * Replies the OSM locale codes for the default locale.
      *
+     * @param prefix a prefix like {@code name:}.
      * @return the OSM locale codes for the default locale
      * @see #getOSMLocaleCodes(String, Locale)
@@ -167,9 +168,9 @@
     /**
      * Replies the locale codes used by OSM for a given locale.
-     *
+     * <p>
      * In most cases OSM uses the 2-character ISO 639 language code ({@link Locale#getLanguage()}
      * to identify the locale of a localized resource, but in some cases it may use the
      * programmatic name for locales, as replied by {@link Locale#toString()}.
-     *
+     * <p>
      * For unknown country codes and variants this function already does fallback to
      * internally known translations.
@@ -191,5 +192,5 @@
                 return new String[]{prefix+"zh-Hant-TW", prefix+"zh-Hant", prefix+"zh"};
             default:
-                var r = new ArrayList<String>();
+                ArrayList<String> r = new ArrayList<>();
                 for (String s : LanguageInfo.getLanguageCodes(null)) {
                     r.add(prefix + s);
@@ -201,5 +202,5 @@
     /**
      * Replies the locale code used by Java for a given locale.
-     *
+     * <p>
      * In most cases JOSM and Java uses the same codes, but for some exceptions this is needed.
      *
@@ -219,11 +220,12 @@
             case "id":
                 return "in";
-        }
-        return localeName;
+            default:
+                return localeName;
+        }
     }
 
     /**
      * Replies the display string used by JOSM for a given locale.
-     *
+     * <p>
      * In most cases returns text replied by {@link Locale#getDisplayName()}, for some
      * locales an override is used (i.e. when unsupported by Java).
@@ -245,5 +247,5 @@
     /**
      * Replies the locale used by Java for a given language code.
-     *
+     * <p>
      * Accepts JOSM and Java codes as input.
      *
@@ -257,5 +259,5 @@
     /**
      * Replies the locale used by Java for a given language code.
-     *
+     * <p>
      * Accepts JOSM, Java and POSIX codes as input.
      *
Index: trunk/src/org/openstreetmap/josm/tools/ListenerList.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ListenerList.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/ListenerList.java	(revision 19101)
@@ -40,5 +40,5 @@
         @Override
         public boolean equals(Object obj) {
-            if (obj != null && obj.getClass() == WeakListener.class) {
+            if (obj instanceof WeakListener) {
                 return Objects.equals(listener.get(), ((WeakListener<?>) obj).listener.get());
             } else {
@@ -72,5 +72,5 @@
     /**
      * Adds a listener. The listener will not prevent the object from being garbage collected.
-     *
+     * <p>
      * This should be used with care. It is better to add good cleanup code.
      * @param listener The listener.
@@ -79,7 +79,6 @@
         if (ensureNotInList(listener)) {
             // clean the weak listeners, just to be sure...
-            while (weakListeners.remove(new WeakListener<T>(null))) {
-                // continue
-            }
+            WeakListener<T> nullListener = new WeakListener<>(null);
+            weakListeners.removeIf(nullListener::equals);
             weakListeners.add(new WeakListener<>(listener));
         }
Index: trunk/src/org/openstreetmap/josm/tools/ListeningCollection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ListeningCollection.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/ListeningCollection.java	(revision 19101)
@@ -32,5 +32,5 @@
     public final Iterator<T> iterator() {
         Iterator<T> it = base.iterator();
-        return new Iterator<T>() {
+        return new Iterator<>() {
             private T object;
 
Index: trunk/src/org/openstreetmap/josm/tools/MultiMap.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/MultiMap.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/MultiMap.java	(revision 19101)
@@ -14,5 +14,5 @@
 /**
  * MultiMap - maps keys to multiple values.
- *
+ * <p>
  * Corresponds to Google guava LinkedHashMultimap and Apache Collections MultiValueMap
  * but it is an independent (simple) implementation.
@@ -59,5 +59,5 @@
     /**
      * Map a key to a value.
-     *
+     * <p>
      * Can be called multiple times with the same key, but different value.
      * @param key key with which the specified value is to be associated
@@ -70,5 +70,5 @@
     /**
      * Put a key that maps to nothing. (Only if it is not already in the map)
-     *
+     * <p>
      * Afterwards containsKey(key) will return true and get(key) will return
      * an empty Set instead of null.
@@ -78,10 +78,10 @@
         if (map.containsKey(key))
             return;
-        map.put(key, new LinkedHashSet<B>());
+        map.put(key, new LinkedHashSet<>());
     }
 
     /**
      * Map the key to all the given values.
-     *
+     * <p>
      * Adds to the mappings that are already there.
      * @param key key with which the specified values are to be associated
@@ -104,5 +104,5 @@
      * Returns the Set associated with the given key. Result is null if
      * nothing has been mapped to this key.
-     *
+     * <p>
      * Modifications of the returned list changes the underling map,
      * but you should better not do that.
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 19101)
@@ -16,5 +16,4 @@
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URI;
@@ -102,20 +101,4 @@
     private static final double TO_RADIANS = Math.PI / 180.0;
 
-    /**
-     * A reference to {@code Map.ofEntries()} available since Java 9
-     */
-    static final Method mapOfEntries = mapOfEntriesMethod();
-
-    private static Method mapOfEntriesMethod() {
-        if (getJavaVersion() >= 9) {
-            try {
-                return Map.class.getMethod("ofEntries", Map.Entry[].class);
-            } catch (NoSuchMethodException noSuchMethodException) {
-                Logging.trace(noSuchMethodException);
-            }
-        }
-        return null;
-    }
-
     private Utils() {
         // Hide default constructor for utils classes
@@ -205,5 +188,5 @@
      * @deprecated since 15718, use {@link String#join} or {@link Collectors#joining}
      */
-    @Deprecated
+    @Deprecated(since = "15718", forRemoval = true)
     public static String join(String sep, Collection<?> values) {
         CheckParameterUtil.ensureParameterNotNull(sep, "sep");
@@ -349,9 +332,5 @@
      */
     public static boolean deleteFileIfExists(File file) {
-        if (file.exists()) {
-            return deleteFile(file);
-        } else {
-            return true;
-        }
+        return !file.exists() || deleteFile(file);
     }
 
@@ -590,5 +569,5 @@
      */
     public static <A, B> Collection<B> transform(final Collection<? extends A> c, final Function<A, B> f) {
-        return new AbstractCollection<B>() {
+        return new AbstractCollection<>() {
 
             @Override
@@ -599,5 +578,5 @@
             @Override
             public Iterator<B> iterator() {
-                return new Iterator<B>() {
+                return new Iterator<>() {
 
                     private final Iterator<? extends A> it = c.iterator();
@@ -632,5 +611,5 @@
      */
     public static <A, B> List<B> transform(final List<? extends A> l, final Function<A, B> f) {
-        return new AbstractList<B>() {
+        return new AbstractList<>() {
 
             @Override
@@ -657,5 +636,4 @@
     @SuppressWarnings("unchecked")
     public static <T> List<T> toUnmodifiableList(Collection<T> collection) {
-        // Java 9: use List.of(...)
         if (isEmpty(collection)) {
             return Collections.emptyList();
@@ -663,5 +641,7 @@
             return Collections.singletonList(collection.iterator().next());
         } else {
-            return (List<T>) Arrays.asList(collection.toArray());
+            // List.copyOf would also work, but if the original collection is immutable, it just returns the original
+            // collection.
+            return (List<T>) List.of(collection.toArray());
         }
     }
@@ -685,13 +665,7 @@
             final Map.Entry<K, V> entry = map.entrySet().iterator().next();
             return Collections.singletonMap(entry.getKey(), entry.getValue());
-        } else if (mapOfEntries != null) {
-            try {
-                // Java 9: use Map.ofEntries(...)
-                return (Map<K, V>) mapOfEntries.invoke(null, (Object) map.entrySet().toArray(new Map.Entry[0]));
-            } catch (ReflectiveOperationException toLog) {
-                Logging.trace(toLog);
-            }
-        }
-        return Collections.unmodifiableMap(map);
+        }
+        // Map.copyOf would also work, but if the original map is immutable, it just returns the original map.
+        return Map.ofEntries(map.entrySet().toArray(new Map.Entry[0]));
     }
 
@@ -849,5 +823,5 @@
     /**
      * Runs an external command and returns the standard output.
-     *
+     * <p>
      * The program is expected to execute fast, as this call waits 10 seconds at most.
      *
@@ -991,6 +965,6 @@
                 sb.append(',').append(cur);
             } else {
-                sb.append('-').append(last);
-                sb.append(',').append(cur);
+                sb.append('-').append(last)
+                  .append(',').append(cur);
                 cnt = 0;
             }
@@ -1129,5 +1103,5 @@
      * Fixes URL with illegal characters in the query (and fragment) part by
      * percent encoding those characters.
-     *
+     * <p>
      * special characters like &amp; and # are not encoded
      *
@@ -1531,5 +1505,5 @@
      * @deprecated since 19050 -- use {@link InputStream#readAllBytes()} instead
      */
-    @Deprecated
+    @Deprecated(since = "19050", forRemoval = true)
     public static byte[] readBytesFromStream(InputStream stream) throws IOException {
         if (stream == null) {
@@ -1644,9 +1618,6 @@
         } else if (val < min) {
             return min;
-        } else if (val > max) {
-            return max;
-        } else {
-            return val;
-        }
+        }
+        return Math.min(val, max);
     }
 
@@ -1860,5 +1831,7 @@
      * @return true if JOSM has been started via Oracle Java Web Start
      * @since 15740
-     */
+     * @deprecated JOSM no longer supports Oracle Java Webstart since Oracle Java Webstart doesn't support Java 9+.
+     */
+    @Deprecated(since = "19101", forRemoval = true)
     public static boolean isRunningJavaWebStart() {
         return isRunningWebStart() && isClassFound("com.sun.javaws.Main");
@@ -2071,23 +2044,8 @@
      */
     public static Double unitToMeter(String s) throws IllegalArgumentException {
-        s = s.replaceAll(" ", "").replaceAll(",", ".");
+        s = s.replace(" ", "").replace(",", ".");
         Matcher m = PATTERN_LENGTH.matcher(s);
         if (m.matches()) {
-            Double v = Double.valueOf(m.group(1));
-            if ("cm".equals(m.group(2)))
-                v *= 0.01;
-            else if ("mm".equals(m.group(2)))
-                v *= 0.001;
-            else if ("km".equals(m.group(2)))
-                v *= 1000.0;
-            else if ("nmi".equals(m.group(2)))
-                v *= 1852.0;
-            else if ("mi".equals(m.group(2)))
-                v *= 1609.344;
-            else if ("ft".equals(m.group(2)) || "'".equals(m.group(2)))
-                v *= 0.3048;
-            else if ("in".equals(m.group(2)) || "\"".equals(m.group(2)))
-                v *= 0.0254;
-            return v;
+            return Double.parseDouble(m.group(1)) * unitToMeterConversion(m.group(2));
         } else {
             m = PATTERN_LENGTH2.matcher(s);
@@ -2095,8 +2053,35 @@
                 /* NOTE: we assume -a'b" means -(a'+b") and not (-a')+b" - because of such issues SI units have been invented
                    and have been adopted by the majority of the world */
-                return (Double.valueOf(m.group(2))*0.3048+Double.valueOf(m.group(4))*0.0254)*(m.group(1).isEmpty() ? 1.0 : -1.0);
+                return (Double.parseDouble(m.group(2))*0.3048+Double.parseDouble(m.group(4))*0.0254)*(m.group(1).isEmpty() ? 1.0 : -1.0);
             }
         }
         throw new IllegalArgumentException("Invalid length value: " + s);
     }
+
+    /**
+     * Get the conversion factor for a specified unit to meters
+     * @param unit The unit to convert to meters
+     * @return The conversion factor or 1.
+     * @throws IllegalArgumentException if the unit does not currently have a conversion
+     */
+    private static double unitToMeterConversion(String unit) throws IllegalArgumentException {
+        if (unit == null) {
+            return 1;
+        }
+        switch (unit) {
+            case "cm": return 0.01;
+            case "mm": return 0.001;
+            case "m": return 1;
+            case "km": return 1000.0;
+            case "nmi": return 1852.0;
+            case "mi": return 1609.344;
+            case "ft":
+            case "'":
+                return 0.3048;
+            case "in":
+            case "\"":
+                return 0.0254;
+            default: throw new IllegalArgumentException("Invalid length unit: " + unit);
+        }
+    }
 }
Index: trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java	(revision 19101)
@@ -32,5 +32,4 @@
  * @since 10285
  */
-@SuppressWarnings("OverrideThrowableToString")
 public class ReportedException extends RuntimeException {
     /**
@@ -168,9 +167,5 @@
      */
     public boolean isSame(ReportedException e) {
-        if (!getMessage().equals(e.getMessage())) {
-            return false;
-        }
-
-        return hasSameStackTrace(new CauseTraceIterator(), e.getCause());
+        return getMessage().equals(e.getMessage()) && hasSameStackTrace(new CauseTraceIterator(), e.getCause());
     }
 
@@ -192,9 +187,6 @@
         if ((c1 == null) != (c2 == null)) {
             return false;
-        } else if (c1 != null) {
-            return hasSameStackTrace(causeTraceIterator, c2);
-        } else {
-            return true;
-        }
+        }
+        return c1 == null || hasSameStackTrace(causeTraceIterator, c2);
     }
 
@@ -231,5 +223,5 @@
                 string = makeCollectionNice((Collection<?>) value);
             } else if (value.getClass().isArray()) {
-                string = makeCollectionNice(Arrays.asList(value));
+                string = makeCollectionNice(Collections.singleton(value));
             } else {
                 string = value.toString();
@@ -283,5 +275,5 @@
      */
     public boolean isOutOfMemory() {
-        return StreamUtils.toStream(CauseTraceIterator::new).anyMatch(t -> t instanceof OutOfMemoryError);
+        return StreamUtils.toStream(CauseTraceIterator::new).anyMatch(OutOfMemoryError.class::isInstance);
     }
 
@@ -293,5 +285,5 @@
     private final class CauseTraceIterator implements Iterator<Throwable> {
         private Throwable current = getCause();
-        private final Set<Throwable> dejaVu = Collections.newSetFromMap(new IdentityHashMap<Throwable, Boolean>());
+        private final Set<Throwable> dejaVu = Collections.newSetFromMap(new IdentityHashMap<>());
 
         @Override
Index: trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java	(revision 19100)
+++ trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java	(revision 19101)
@@ -62,8 +62,6 @@
     @Override
     public boolean isValid(TemplateEngineDataProvider dataProvider) {
-        if (special && SPECIAL_VALUE_EVERYTHING.equals(variableName))
-            return true;
-        else
-            return dataProvider.getTemplateValue(variableName, special) != null;
+        return (special && SPECIAL_VALUE_EVERYTHING.equals(variableName))
+            || dataProvider.getTemplateValue(variableName, special) != null;
     }
 
@@ -94,12 +92,5 @@
             return false;
         Variable other = (Variable) obj;
-        if (special != other.special)
-            return false;
-        if (variableName == null) {
-            if (other.variableName != null)
-                return false;
-        } else if (!variableName.equals(other.variableName))
-            return false;
-        return true;
+        return this.special == other.special && Objects.equals(this.variableName, other.variableName);
     }
 }
