Subject: [PATCH] Minor fixes
---
Index: src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java b/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java
--- a/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java	(date 1679257200918)
@@ -98,7 +98,7 @@
                 String leftRight = m.group(2).toLowerCase(Locale.ENGLISH);
 
                 StringBuilder result = new StringBuilder();
-                result.append(text.substring(0, m.start(2)))
+                result.append(text, 0, m.start(2))
                       .append(leftRight.equals(a) ? b : a)
                       .append(text.substring(m.end(2)));
 
Index: src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java b/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
--- a/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(date 1679257200938)
@@ -141,7 +141,7 @@
             }
         }
         text.format("Locale info: %s%n", Locale.getDefault().toString());
-        text.format("Numbers with default locale: %s -> %d%n", Integer.toString(1_234_567_890), 1_234_567_890);
+        text.format("Numbers with default locale: %s -> %d%n", 1_234_567_890, 1_234_567_890);
 
         if (PlatformManager.isPlatformUnixoid()) {
             PlatformHookUnixoid platform = (PlatformHookUnixoid) PlatformManager.getPlatform();
Index: src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java b/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
--- a/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java	(date 1679257200938)
@@ -156,13 +156,11 @@
         // Remove broken ways
         result.removeIf(way -> way.getNodesCount() <= 2);
 
-        if (selectedWays.isEmpty())
-            return result;
-        else {
-            // Return only selected ways
+        // Remove selected ways
+        if (!selectedWays.isEmpty()) {
             result.removeIf(way -> !selectedWays.contains(way));
-            return result;
-        }
+        }
+        return result;
     }
 
     @Override
Index: src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java b/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
--- a/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java	(date 1679257200946)
@@ -102,9 +102,7 @@
                 if (preExistingData.stream().anyMatch(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId()))) {
                     Optional<PrimitiveData> o = data.stream()
                             .filter(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId())).findAny();
-                    if (o.isPresent()) {
-                        osm.load(o.get());
-                    }
+                    o.ifPresent(osm::load);
                 } else {
                     ds.addPrimitive(osm);
                 }
Index: src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java b/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
--- a/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(date 1679263492861)
@@ -110,7 +110,7 @@
 
         try {
             if (!cacheDir.exists() && !cacheDir.mkdirs()) {
-                Logging.warn("Cache directory " + cacheDir.toString() + " does not exists and could not create it");
+                Logging.warn("Cache directory " + cacheDir + " does not exists and could not create it");
             } else {
                 File cacheDirLockPath = new File(cacheDir, ".lock");
                 try {
Index: src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java b/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java
--- a/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java	(date 1679257200954)
@@ -478,7 +478,7 @@
         } else {
             zoomSelector = EMPTY_STRING;
         }
-        final String commonData = zoomSelector + this.filter.toString() + "::" + this.id + "{" + this.paintProperties + "}";
+        final String commonData = zoomSelector + this.filter + "::" + this.id + "{" + this.paintProperties + "}";
 
         if (this.type == Type.CIRCLE || this.type == Type.SYMBOL) {
             return "node" + commonData;
Index: src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java b/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
--- a/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java	(date 1679257200962)
@@ -618,7 +618,7 @@
             }
         }
         if (nameTag == null) {
-            sb.append(Long.toString(relation.getId())).append(", ");
+            sb.append(relation.getId()).append(", ");
         } else {
             sb.append('\"').append(nameTag).append("\", ");
         }
Index: src/org/openstreetmap/josm/data/osm/Node.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/osm/Node.java b/src/org/openstreetmap/josm/data/osm/Node.java
--- a/src/org/openstreetmap/josm/data/osm/Node.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/osm/Node.java	(date 1679257200974)
@@ -202,7 +202,7 @@
     void setDataset(DataSet dataSet) {
         super.setDataset(dataSet);
         if (!isIncomplete() && isVisible() && !isLatLonKnown())
-            throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString());
+            throw new DataIntegrityProblemException("Complete node with null coordinates: " + this);
     }
 
     @Override
Index: src/org/openstreetmap/josm/data/osm/OsmDataManager.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/osm/OsmDataManager.java b/src/org/openstreetmap/josm/data/osm/OsmDataManager.java
--- a/src/org/openstreetmap/josm/data/osm/OsmDataManager.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/osm/OsmDataManager.java	(date 1679257200974)
@@ -70,9 +70,7 @@
     public void setActiveDataSet(DataSet ds) {
         Optional<OsmDataLayer> layer = MainApplication.getLayerManager().getLayersOfType(OsmDataLayer.class).stream()
                 .filter(l -> l.data.equals(ds)).findFirst();
-        if (layer.isPresent()) {
-            MainApplication.getLayerManager().setActiveLayer(layer.get());
-        }
+        layer.ifPresent(osmDataLayer -> MainApplication.getLayerManager().setActiveLayer(osmDataLayer));
     }
 
     @Override
Index: src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java b/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
--- a/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(date 1679257200990)
@@ -195,7 +195,7 @@
      */
     public void checkDataset() {
         if (dataSet == null)
-            throw new DataIntegrityProblemException("Primitive must be part of the dataset: " + toString());
+            throw new DataIntegrityProblemException("Primitive must be part of the dataset: " + this);
     }
 
     /**
@@ -203,7 +203,7 @@
      */
     protected final void checkDatasetNotReadOnly() {
         if (dataSet != null && dataSet.isLocked())
-            throw new DataIntegrityProblemException("Primitive cannot be modified in read-only dataset: " + toString());
+            throw new DataIntegrityProblemException("Primitive cannot be modified in read-only dataset: " + this);
     }
 
     protected boolean writeLock() {
@@ -991,9 +991,9 @@
     }
 
     /**
-     * Equal, if the id (and class) is equal.
-     *
-     * An primitive is equal to its incomplete counter part.
+     * Equal if the id (and class) are equal.
+     * <p>
+     * A primitive is equal to its incomplete counterpart.
      */
     @Override
     public boolean equals(Object obj) {
@@ -1009,8 +1009,8 @@
 
     /**
      * Return the id plus the class type encoded as hashcode or super's hashcode if id is 0.
-     *
-     * An primitive has the same hashcode as its incomplete counterpart.
+     * <p>
+     * A primitive has the same hashcode as its incomplete counterpart.
      */
     @Override
     public int hashCode() {
Index: src/org/openstreetmap/josm/data/osm/Relation.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/osm/Relation.java b/src/org/openstreetmap/josm/data/osm/Relation.java
--- a/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/osm/Relation.java	(date 1679257200998)
@@ -443,7 +443,7 @@
         }
 
         BBox box = new BBox();
-        addToBBox(box, new HashSet<PrimitiveId>());
+        addToBBox(box, new HashSet<>());
         if (getDataSet() == null) {
             return box;
         }
@@ -493,7 +493,7 @@
             if (Config.getPref().getBoolean("debug.checkDeleteReferenced", true)) {
                 for (RelationMember rm: members) {
                     if (rm.getMember().isDeleted())
-                        throw new DataIntegrityProblemException("Deleted member referenced: " + toString(), null, this, rm.getMember());
+                        throw new DataIntegrityProblemException("Deleted member referenced: " + this, null, this, rm.getMember());
                 }
             }
         }
@@ -524,8 +524,8 @@
     @Override
     public Collection<OsmPrimitive> getIncompleteMembers() {
         return Arrays.stream(members)
-                .filter(rm -> rm.getMember().isIncomplete())
                 .map(RelationMember::getMember)
+                .filter(AbstractPrimitive::isIncomplete)
                 .collect(Collectors.toSet());
     }
 
Index: src/org/openstreetmap/josm/data/osm/Way.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/osm/Way.java b/src/org/openstreetmap/josm/data/osm/Way.java
--- a/src/org/openstreetmap/josm/data/osm/Way.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/osm/Way.java	(date 1679257201006)
@@ -551,7 +551,7 @@
                     throw new DataIntegrityProblemException("Nodes in way must be in the same dataset",
                             tr("Nodes in way must be in the same dataset"));
                 if (n.isDeleted())
-                    throw new DataIntegrityProblemException("Deleted node referenced: " + toString(),
+                    throw new DataIntegrityProblemException("Deleted node referenced: " + this,
                             "<html>" + tr("Deleted node referenced by {0}",
                                     DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>",
                             this, n);
@@ -559,7 +559,7 @@
             if (Config.getPref().getBoolean("debug.checkNullCoor", true)) {
                 for (Node n: nodes) {
                     if (n.isVisible() && !n.isIncomplete() && !n.isLatLonKnown())
-                        throw new DataIntegrityProblemException("Complete visible node with null coordinates: " + toString(),
+                        throw new DataIntegrityProblemException("Complete visible node with null coordinates: " + this,
                                 "<html>" + tr("Complete node {0} with null coordinates in way {1}",
                                         DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(n),
                                         DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>",
Index: src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java b/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
--- a/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java	(date 1679257201010)
@@ -154,7 +154,7 @@
             EastNorth enOut = toProj.latlon2eastNorth(ll);
             double cOut1 = argSwitchOutput ? enOut.north() : enOut.east();
             double cOut2 = argSwitchOutput ? enOut.east() : enOut.north();
-            System.out.println(Double.toString(cOut1) + " " + Double.toString(cOut2));
+            System.out.println(cOut1 + " " + cOut2);
             System.out.flush();
         }
     }
Index: src/org/openstreetmap/josm/data/validation/tests/Lanes.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/validation/tests/Lanes.java b/src/org/openstreetmap/josm/data/validation/tests/Lanes.java
--- a/src/org/openstreetmap/josm/data/validation/tests/Lanes.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/validation/tests/Lanes.java	(date 1679257201014)
@@ -63,8 +63,8 @@
                             .primitives(p)
                             .build());
                 }
-            } catch (NumberFormatException ignore) {
-                Logging.debug(ignore.getMessage());
+            } catch (NumberFormatException e) {
+                Logging.debug(e.getMessage());
             }
         }
     }
@@ -75,14 +75,14 @@
         final String forward = Utils.firstNonNull(p.get("lanes:forward"), "0");
         final String backward = Utils.firstNonNull(p.get("lanes:backward"), "0");
         try {
-        if (Integer.parseInt(lanes) < Integer.parseInt(forward) + Integer.parseInt(backward)) {
-            errors.add(TestError.builder(this, Severity.WARNING, 3101)
-                    .message(tr("Number of {0} greater than {1}", tr("{0}+{1}", "lanes:forward", "lanes:backward"), "lanes"))
-                    .primitives(p)
-                    .build());
-        }
-        } catch (NumberFormatException ignore) {
-            Logging.debug(ignore.getMessage());
+            if (Integer.parseInt(lanes) < Integer.parseInt(forward) + Integer.parseInt(backward)) {
+                errors.add(TestError.builder(this, Severity.WARNING, 3101)
+                        .message(tr("Number of {0} greater than {1}", tr("{0}+{1}", "lanes:forward", "lanes:backward"), "lanes"))
+                        .primitives(p)
+                        .build());
+            }
+        } catch (NumberFormatException e) {
+            Logging.debug(e.getMessage());
         }
     }
 
Index: src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java b/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
--- a/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(date 1679257201018)
@@ -444,7 +444,7 @@
                 cnt++;
                 // add frequently changing info to progress monitor so that it
                 // doesn't seem to hang when test takes longer than 0.5 seconds
-                if (cnt % 10000 == 0 && stopwatch.elapsed() >= 500) {
+                if (cnt % 10_000 == 0 && stopwatch.elapsed() >= 500) {
                     progressMonitor.setExtraText(tr(" {0}: {1} of {2} elements done", title, cnt, selection.size()));
                 }
             }
@@ -487,7 +487,5 @@
                     addIfNotSimilar(e, errors);
             }
         }
-
     }
-
 }
Index: src/org/openstreetmap/josm/data/validation/ValidationTask.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/validation/ValidationTask.java b/src/org/openstreetmap/josm/data/validation/ValidationTask.java
--- a/src/org/openstreetmap/josm/data/validation/ValidationTask.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/data/validation/ValidationTask.java	(date 1679257201042)
@@ -36,7 +36,7 @@
      *
      * @param tests                     the tests to run
      * @param validatedPrimitives       the collection of primitives to validate.
-     * @param formerValidatedPrimitives the last collection of primitives being validates. May be null.
+     * @param formerValidatedPrimitives the last collection of primitives being validated. May be null.
      */
     public ValidationTask(Collection<Test> tests,
                           Collection<OsmPrimitive> validatedPrimitives,
@@ -48,7 +48,7 @@
                              Collection<Test> tests,
                              Collection<OsmPrimitive> validatedPrimitives,
                              Collection<OsmPrimitive> formerValidatedPrimitives) {
-        super(tr("Validating"), progressMonitor, false /*don't ignore exceptions */);
+        super(tr("Validating"), progressMonitor, false);
         this.validatedPrimitives = validatedPrimitives;
         this.formerValidatedPrimitives = formerValidatedPrimitives;
         this.tests = tests;
Index: src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java b/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java
--- a/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java	(date 1679257201058)
@@ -216,10 +216,10 @@
          */
         protected void renderValue(Object value) {
             setFont(UIManager.getFont("ComboBox.font"));
-            if (String.class.isInstance(value)) {
-                setText(String.class.cast(value));
-            } else if (MultiValueDecisionType.class.isInstance(value)) {
-                switch(MultiValueDecisionType.class.cast(value)) {
+            if (value instanceof String) {
+                setText((String) value);
+            } else if (value instanceof MultiValueDecisionType) {
+                switch((MultiValueDecisionType) value) {
                 case UNDECIDED:
                     setText(tr("Choose a value"));
                     setFont(UIManager.getFont("ComboBox.font").deriveFont(Font.ITALIC + Font.BOLD));
Index: src/org/openstreetmap/josm/gui/correction/CorrectionTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java b/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java
--- a/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java	(date 1679262631959)
@@ -38,7 +38,7 @@
         super(correctionTableModel);
 
         final int correctionsSize = correctionTableModel.getCorrections().size();
-        final int lines = correctionsSize > MAX_VISIBLE_LINES ? MAX_VISIBLE_LINES : correctionsSize;
+        final int lines = Math.min(correctionsSize, MAX_VISIBLE_LINES);
         setPreferredScrollableViewportSize(new Dimension(400, lines * getRowHeight()));
         getColumnModel().getColumn(correctionTableModel.getApplyColumn()).setPreferredWidth(40);
         setRowSelectionAllowed(false);
Index: src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java b/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java
--- a/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java	(date 1679257201066)
@@ -65,9 +65,7 @@
         if (Utils.isBlank(value)) return 0;
         try {
             int uid = Integer.parseInt(value.trim());
-            if (uid > 0)
-                return uid;
-            return 0;
+            return Math.max(uid, 0);
         } catch (NumberFormatException e) {
             return 0;
         }
Index: src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java b/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java
--- a/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java	(date 1679257201070)
@@ -81,10 +81,6 @@
         // just init the model content. Don't register as DataSetListener. The mode
         // is already registered to receive DataChangedEvents from the current edit layer
         DataSet ds = e.getSource().getActiveDataSet();
-        if (ds != null) {
-            initFromDataSet(ds);
-        } else {
-            initFromDataSet(null);
-        }
+        initFromDataSet(ds);
     }
 }
Index: src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java b/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
--- a/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java	(date 1679257201078)
@@ -26,6 +26,7 @@
 import org.openstreetmap.josm.actions.AutoScaleAction.AutoScaleMode;
 import org.openstreetmap.josm.actions.HistoryInfoAction;
 import org.openstreetmap.josm.actions.ZoomToAction;
+import org.openstreetmap.josm.data.osm.AbstractPrimitive;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.RelationMember;
@@ -130,8 +131,8 @@
         if (MainApplication.isDisplayingMapView()) {
             Collection<RelationMember> sel = getMemberTableModel().getSelectedMembers();
             final Set<OsmPrimitive> toHighlight = sel.stream()
-                    .filter(r -> r.getMember().isUsable())
                     .map(RelationMember::getMember)
+                    .filter(AbstractPrimitive::isUsable)
                     .collect(Collectors.toSet());
             SwingUtilities.invokeLater(() -> {
                 if (MainApplication.isDisplayingMapView() && highlightHelper.highlightOnly(toHighlight)) {
Index: src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java b/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
--- a/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java	(date 1679257201082)
@@ -551,8 +551,8 @@
     public Set<OsmPrimitive> getChildPrimitives(Collection<? extends OsmPrimitive> referenceSet) {
         if (referenceSet == null) return null;
         return members.stream()
-                .filter(m -> referenceSet.contains(m.getMember()))
                 .map(RelationMember::getMember)
+                .filter(referenceSet::contains)
                 .collect(Collectors.toSet());
     }
 
Index: src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java b/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
--- a/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java	(date 1679257201086)
@@ -128,7 +128,7 @@
                 Set<String> tests = new HashSet<>();
                 visitTestErrors(node, err -> tests.add(getTesterDetails(err)), null);
                 String source = (tests.size() == 1) ? tr("Test: {0}", tests.iterator().next()) : tr("Different tests");
-                res = node.toString() + "<br>" + source;
+                res = node + "<br>" + source;
             }
         }
         return res == null ? null : "<html>" + res + "</html>";
Index: src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java b/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
--- a/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java	(date 1679257201090)
@@ -192,7 +192,7 @@
         tfLatLon.setText(CoordinateFormatManager.getDefaultFormat().latToString(llc) + ' ' +
                          CoordinateFormatManager.getDefaultFormat().lonToString(llc));
         EastNorth en = ProjectionRegistry.getProjection().latlon2eastNorth(llc);
-        tfEastNorth.setText(Double.toString(en.east()) + ' ' + Double.toString(en.north()));
+        tfEastNorth.setText(Double.toString(en.east()) + ' ' + en.north());
         // Both latLonCoordinates and eastNorthCoordinates may have been reset to null if ll is out of the world
         latLonCoordinates = llc;
         eastNorthCoordinates = en;
Index: src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java b/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
--- a/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(date 1679257201094)
@@ -143,7 +143,6 @@
         gc.fill = GridBagConstraints.BOTH;
         gc.weightx = 1.0;
         gc.weighty = 1.0;
-        gc.gridx = 1;
         dlg.add(new JScrollPane(bookmarks), gc);
 
         this.parent = gui;
Index: src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java b/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
--- a/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java	(date 1679257201094)
@@ -5,7 +5,7 @@
 
 import java.awt.BorderLayout;
 import java.awt.Dimension;
-import java.util.Arrays;
+import java.util.stream.Stream;
 
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -161,7 +161,7 @@
             model.unlinkAsListener();
             model = null;
         }
-        Arrays.asList(tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer).stream()
+        Stream.of(tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer)
                 .filter(Destroyable.class::isInstance).forEach(Destroyable::destroy);
         tagInfoViewer = null;
         nodeListViewer = null;
Index: src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java b/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
--- a/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java	(date 1679263031450)
@@ -78,7 +78,7 @@
 
     @Override
     public boolean acceptFile(File pathname, Layer layer) {
-        return isSupportedLayer(layer) ? super.acceptFile(pathname, layer) : false;
+        return isSupportedLayer(layer) && super.acceptFile(pathname, layer);
     }
 
     @Override
Index: src/org/openstreetmap/josm/gui/io/importexport/GpxLikeImporter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/io/importexport/GpxLikeImporter.java b/src/org/openstreetmap/josm/gui/io/importexport/GpxLikeImporter.java
--- a/src/org/openstreetmap/josm/gui/io/importexport/GpxLikeImporter.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/io/importexport/GpxLikeImporter.java	(date 1679257201102)
@@ -74,7 +74,7 @@
         msg.append("</html>");
         if (success) {
             SwingUtilities.invokeLater(() -> new Notification(
-                    "<h3>" + tr("Import success:") + "</h3>" + msg.toString())
+                    "<h3>" + tr("Import success:") + "</h3>" + msg)
                     .setIcon(JOptionPane.INFORMATION_MESSAGE)
                     .show());
         } else {
Index: src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java b/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
--- a/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java	(date 1679264631294)
@@ -53,7 +53,6 @@
     private JosmComboBox<Changeset> cbOpenChangesets;
     private JosmComboBoxModel<Changeset> model;
     private JCheckBox cbCloseAfterUpload;
-    private JButton btnClose;
 
     /**
      * Constructs a new {@code ChangesetManagementPanel}.
@@ -126,7 +125,7 @@
 
         gc.gridx++;
         CloseChangesetAction closeChangesetAction = new CloseChangesetAction();
-        btnClose = new JButton(closeChangesetAction);
+        JButton btnClose = new JButton(closeChangesetAction);
         btnClose.setPreferredSize(prefSize);
         btnClose.setMinimumSize(prefSize);
         add(btnClose, gc);
@@ -277,6 +276,6 @@
     @Override
     public void changesetCacheUpdated(ChangesetCacheEvent event) {
         // This listener might have been called by a background task.
-        SwingUtilities.invokeLater(() -> refreshCombo());
+        SwingUtilities.invokeLater(this::refreshCombo);
     }
 }
Index: src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java b/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
--- a/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java	(date 1679257201106)
@@ -130,11 +130,10 @@
      * @param unzip - if true file wil be unzipped and deleted after download
      */
     public static void processDownloadOperation(String address, String path, String parentDir, boolean mkdir, boolean unzip) {
-        String dir = parentDir;
         if (path.contains("..") || path.startsWith("/") || path.contains(":")) {
             return; // some basic protection
         }
-        File fOut = new File(dir, path);
+        File fOut = new File(parentDir, path);
         DownloadFileTask downloadFileTask = new DownloadFileTask(MainApplication.getMainFrame(), address, fOut, mkdir, unzip);
 
         MainApplication.worker.submit(downloadFileTask);
Index: src/org/openstreetmap/josm/gui/io/UploadDialogModel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java b/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java
--- a/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java	(date 1679257201110)
@@ -75,11 +75,10 @@
      * @return the hashtags separated by ";" or null
      */
     String findHashTags(String comment) {
-        String hashtags = String.join(";",
-            Arrays.stream(comment.split("\\s", -1))
-                .map(s -> Utils.strip(s, ",;"))
-                .filter(s -> s.matches("#[a-zA-Z0-9][-_a-zA-Z0-9]+"))
-                .collect(Collectors.toList()));
+        String hashtags = Arrays.stream(comment.split("\\s", -1))
+            .map(s -> Utils.strip(s, ",;"))
+            .filter(s -> s.matches("#[a-zA-Z0-9][-_a-zA-Z0-9]+"))
+            .collect(Collectors.joining(";"));
         return hashtags.isEmpty() ? null : hashtags;
     }
 
@@ -155,7 +154,7 @@
      */
     public void putAll(Map<String, String> map) {
         commitPendingEdit();
-        map.forEach((key, value) -> doPut(key, value));
+        map.forEach(this::doPut);
         setDirty(true);
         fireTableDataChanged();
     }
Index: src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java b/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
--- a/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(date 1679257201118)
@@ -9,8 +9,8 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Comparator;
+import java.util.List;
 import java.util.stream.Collectors;
 
 import javax.swing.AbstractAction;
@@ -125,7 +125,7 @@
         URL url = Utils.fileToURL(audioFile);
         boolean hasTracks = !Utils.isEmpty(layer.data.tracks);
         boolean hasWaypoints = !Utils.isEmpty(layer.data.waypoints);
-        Collection<WayPoint> waypoints = new ArrayList<>();
+        List<WayPoint> waypoints = new ArrayList<>();
         boolean timedMarkersOmitted = false;
         boolean untimedMarkersOmitted = false;
         double snapDistance = Config.getPref().getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3);
@@ -272,7 +272,7 @@
         }
 
         // we must have got at least one waypoint now
-        ((ArrayList<WayPoint>) waypoints).sort(Comparator.naturalOrder());
+        waypoints.sort(Comparator.naturalOrder());
 
         firstTime = -1.0; // this time of the first waypoint, not first trackpoint
         for (WayPoint w : waypoints) {
Index: src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java b/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java
--- a/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java	(date 1679257201122)
@@ -212,11 +212,7 @@
         int val = (int) (colorfulness * color + (1 - colorfulness) * luminosity);
         if (val < 0) {
             return 0;
-        } else if (val > 0xff) {
-            return 0xff;
-        } else {
-            return val;
-        }
+        } else return Math.min(val, 0xff);
     }
 
     private byte mix(int color, double luminosity) {
Index: src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java b/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
--- a/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(date 1679257201126)
@@ -778,7 +778,7 @@
     private void zoomChanged(boolean invalidate) {
         Logging.debug("zoomChanged(): {0}", currentZoomLevel);
         if (tileLoader instanceof TMSCachedTileLoader) {
-            ((TMSCachedTileLoader) tileLoader).cancelOutstandingTasks();
+            tileLoader.cancelOutstandingTasks();
         }
         if (invalidate) {
             invalidate();
@@ -1148,7 +1148,7 @@
             StringBuilder line = new StringBuilder();
             StringBuilder ret = new StringBuilder();
             for (String s: text.split(" ", -1)) {
-                if (g.getFontMetrics().stringWidth(line.toString() + s) > tileSource.getTileSize()) {
+                if (g.getFontMetrics().stringWidth(line + s) > tileSource.getTileSize()) {
                     ret.append(line).append('\n');
                     line.setLength(0);
                 }
Index: src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj b/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
--- a/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(date 1679257201146)
@@ -710,7 +710,7 @@
 Condition simple_key_condition(Context context) :
 {
     boolean not = false;
-    KeyMatchType matchType = null;;
+    KeyMatchType matchType = null;
     String key;
 }
 {
@@ -731,7 +731,7 @@
     String val;
     float f;
     int i;
-    KeyMatchType matchType = null;;
+    KeyMatchType matchType = null;
     Op op;
     boolean considerValAsKey = false;
 }
Index: src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java b/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
--- a/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(date 1679264631294)
@@ -19,6 +19,10 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import oauth.signpost.OAuth;
+import oauth.signpost.OAuthConsumer;
+import oauth.signpost.OAuthProvider;
+import oauth.signpost.exception.OAuthException;
 import org.openstreetmap.josm.data.oauth.OAuthParameters;
 import org.openstreetmap.josm.data.oauth.OAuthToken;
 import org.openstreetmap.josm.data.oauth.OsmPrivileges;
@@ -30,11 +34,6 @@
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Utils;
 
-import oauth.signpost.OAuth;
-import oauth.signpost.OAuthConsumer;
-import oauth.signpost.OAuthProvider;
-import oauth.signpost.exception.OAuthException;
-
 /**
  * An OAuth 1.0 authorization client.
  * @since 2746
@@ -198,9 +197,6 @@
 
         for (String setCookie: setCookies) {
             String[] kvPairs = setCookie.split(";", -1);
-            if (kvPairs.length == 0) {
-                continue;
-            }
             for (String kvPair : kvPairs) {
                 kvPair = kvPair.trim();
                 String[] kv = kvPair.split("=", -1);
Index: src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java b/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java
--- a/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java	(date 1679257201150)
@@ -107,7 +107,7 @@
         public void valueChanged(ListSelectionEvent e) {
             TableCellEditor editor = table.getCellEditor();
             if (editor != null) {
-                ((DefaultCellEditor) editor).stopCellEditing();
+                editor.stopCellEditing();
             }
             if (entryList.getSelectedIndices().length != 1) {
                 entryIdx = null;
Index: src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java b/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java
--- a/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java	(date 1679257201170)
@@ -90,7 +90,7 @@
     public String getCurrentCode() {
         int zone = index + 1;
         int code = 32600 + zone + (hemisphere == Hemisphere.South ? 100 : 0);
-        return "EPSG:" + Integer.toString(code);
+        return "EPSG:" + code;
     }
 
     @Override
Index: src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java b/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
--- a/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(date 1679257201174)
@@ -1249,7 +1249,7 @@
             sc = ((JosmAction) action.getAction()).getShortcut();
             if (sc.getAssignedKey() == KeyEvent.CHAR_UNDEFINED) {
                 sc = null;
-        }
+            }
         }
 
         long paramCode = 0;
Index: src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java b/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
--- a/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java	(date 1679257201186)
@@ -10,7 +10,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -311,7 +310,7 @@
         }
 
         if (values_sort && TaggingPresets.SORT_MENU.get()) {
-            Collections.sort(presetListEntries, (a, b) -> AlphanumComparator.getInstance().compare(a.getDisplayValue(), b.getDisplayValue()));
+            presetListEntries.sort((a, b) -> AlphanumComparator.getInstance().compare(a.getDisplayValue(), b.getDisplayValue()));
         }
     }
 
Index: src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java b/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java
--- a/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java	(date 1679257201190)
@@ -82,7 +82,7 @@
      */
     public String getListDisplay(int width) {
         String displayValue = getDisplayValue();
-        Integer count = getCount();
+        int count = getCount();
 
         if (count > 0 && cms.usage.getSelectedCount() > 1) {
             displayValue = tr("{0} ({1})", displayValue, count);
Index: src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java b/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
--- a/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java	(date 1679257201198)
@@ -278,14 +278,14 @@
                         try {
                             result.attachImageIcon(this, true);
                         } catch (IllegalArgumentException e) {
-                            Logging.warn(toString() + ": " + PRESET_ICON_ERROR_MSG_PREFIX + iconName);
+                            Logging.warn(this + ": " + PRESET_ICON_ERROR_MSG_PREFIX + iconName);
                             Logging.warn(e);
                         } finally {
                             iconFuture.complete(null);
                         }
                     });
                 } else {
-                    Logging.warn(toString() + ": " + PRESET_ICON_ERROR_MSG_PREFIX + iconName);
+                    Logging.warn(this + ": " + PRESET_ICON_ERROR_MSG_PREFIX + iconName);
                     iconFuture.complete(null);
                 }
             });
Index: src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java b/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
--- a/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(date 1679257201202)
@@ -530,8 +530,8 @@
      */
     public List<String> getKeys() {
         return tags.stream()
-                .filter(tag -> !Utils.isStripEmpty(tag.getName()))
                 .map(TagModel::getName)
+                .filter(name -> !Utils.isStripEmpty(name))
                 .collect(Collectors.toList());
     }
 
Index: src/org/openstreetmap/josm/gui/MapStatus.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/MapStatus.java b/src/org/openstreetmap/josm/gui/MapStatus.java
--- a/src/org/openstreetmap/josm/gui/MapStatus.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/gui/MapStatus.java	(date 1679257201214)
@@ -645,7 +645,7 @@
             osm.visitKeys((primitive, key, value) -> text.append("<br>").append(key).append('=').append(value));
 
             final JLabel l = new JLabel(
-                    "<html>" + text.toString() + "</html>",
+                    "<html>" + text + "</html>",
                     ImageProvider.get(osm.getDisplayType()),
                     JLabel.HORIZONTAL
                     ) {
Index: src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java b/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
--- a/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(date 1679257201214)
@@ -202,7 +202,7 @@
          */
         if (GLOBAL_CONFIRMATION.get()) {
             // Ensure dialog box does not exceed main window size
-            Integer maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth()*0.6);
+            int maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth()*0.6);
             String message = "<html><div>" + getPermissionMessage() +
                     "<br/>" + tr("Do you want to allow this?") + "</div></html>";
             JLabel label = new JLabel(message);
@@ -356,12 +356,12 @@
     protected DownloadParams getDownloadParams() {
         DownloadParams result = new DownloadParams();
         if (args != null) {
-            result = result
-                .withNewLayer(isLoadInNewLayer())
-                .withLayerName(args.get("layer_name"))
-                .withLocked(get("layer_locked"))
-                .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL))
-                .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL));
+            result
+                    .withNewLayer(isLoadInNewLayer())
+                    .withLayerName(args.get("layer_name"))
+                    .withLocked(get("layer_locked"))
+                    .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL))
+                    .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL));
         }
         return result;
     }
Index: src/org/openstreetmap/josm/io/ChangesetQuery.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/io/ChangesetQuery.java b/src/org/openstreetmap/josm/io/ChangesetQuery.java
--- a/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/io/ChangesetQuery.java	(date 1679257201222)
@@ -264,7 +264,7 @@
      * Restricts the result to changesets which have been closed after the date given by <code>d</code>.
      * <code>d</code> d is a date relative to the current time zone.
      *
-     * @param d the date . Must not be null.
+     * @param d the date. Must not be null.
      * @return the restricted changeset query
      * @throws IllegalArgumentException if d is null
      */
@@ -368,12 +368,12 @@
             if (sb.length() > 0) {
                 sb.append('&');
             }
-            sb.append("open=").append(Boolean.toString(open));
+            sb.append("open=").append(open);
         } else if (closed != null) {
             if (sb.length() > 0) {
                 sb.append('&');
             }
-            sb.append("closed=").append(Boolean.toString(closed));
+            sb.append("closed=").append(closed);
         } else if (changesetIds != null) {
             // since 2013-12-05, see https://github.com/openstreetmap/openstreetmap-website/commit/1d1f194d598e54a5d6fb4f38fb569d4138af0dc8
             if (sb.length() > 0) {
@@ -569,7 +569,7 @@
          * <code>query</code> is the query part of a API url for querying changesets,
          * see <a href="http://wiki.openstreetmap.org/wiki/API_v0.6#Query:_GET_.2Fapi.2F0.6.2Fchangesets">OSM API</a>.
          *
-         * Example for an query string:<br>
+         * Example for a query string:<br>
          * <pre>
          *    uid=1234&amp;open=true
          * </pre>
Index: src/org/openstreetmap/josm/plugins/PluginHandler.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/plugins/PluginHandler.java b/src/org/openstreetmap/josm/plugins/PluginHandler.java
--- a/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/plugins/PluginHandler.java	(date 1679257201226)
@@ -465,7 +465,7 @@
         } else {
             long tim = System.currentTimeMillis();
             long last = Config.getPref().getLong("pluginmanager.lastupdate", 0);
-            Integer maxTime = Config.getPref().getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL);
+            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));
@@ -1020,7 +1020,7 @@
         }
         try {
             monitor.beginTask(tr("Determining plugins to load..."));
-            Set<String> plugins = new HashSet<>(Config.getPref().getList("plugins", new LinkedList<String>()));
+            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");
             if (systemProp != null) {
Index: src/org/openstreetmap/josm/tools/ColorScale.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/tools/ColorScale.java b/src/org/openstreetmap/josm/tools/ColorScale.java
--- a/src/org/openstreetmap/josm/tools/ColorScale.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/tools/ColorScale.java	(date 1679262332124)
@@ -249,7 +249,7 @@
         FontMetrics fm = g.getFontMetrics();
         fh = fm.getHeight()/2;
         if (colorBarTitles != null && colorBarTitles.length > 0) {
-             fw = Arrays.asList(colorBarTitles).stream().mapToInt(title -> fm.stringWidth(title)).max().orElse(50);
+             fw = Arrays.stream(colorBarTitles).mapToInt(fm::stringWidth).max().orElse(50);
         } else {
             fw = fm.stringWidth(
                     String.valueOf(Math.max((int) Math.abs(max * valueScale), (int) Math.abs(min * valueScale))))
Index: src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java b/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
--- a/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java	(date 1679257201386)
@@ -135,7 +135,7 @@
             return Double.parseDouble(map.get(key));
         if (map.containsKey('m'+key))
             return Double.parseDouble(map.get('m'+key));
-        throw new IllegalArgumentException(map.toString() + " does not contain " + key);
+        throw new IllegalArgumentException(map + " does not contain " + key);
     }
 
     private static final char[] SHORTLINK_CHARS = {
Index: src/org/openstreetmap/josm/tools/Shortcut.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/tools/Shortcut.java b/src/org/openstreetmap/josm/tools/Shortcut.java
--- a/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/tools/Shortcut.java	(date 1679257201394)
@@ -521,7 +521,7 @@
     // and now the workhorse. same parameters as above, just one more
     private static Shortcut registerShortcut(String shortText, String longText, int requestedKey, int requestedGroup, Integer modifier) {
         doInit();
-        Integer defaultModifier = findModifier(requestedGroup, modifier);
+        int defaultModifier = findModifier(requestedGroup, modifier);
         final Optional<Shortcut> existing = findShortcutByKeyOrShortText(requestedKey, defaultModifier, shortText);
         if (existing.isPresent() && shortText.equals(existing.get().getShortText())) {
             // a re-register? maybe a sc already read from the preferences?
Index: src/org/openstreetmap/josm/tools/Utils.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/tools/Utils.java b/src/org/openstreetmap/josm/tools/Utils.java
--- a/src/org/openstreetmap/josm/tools/Utils.java	(revision 18694)
+++ b/src/org/openstreetmap/josm/tools/Utils.java	(date 1679257201402)
@@ -1642,11 +1642,7 @@
             throw new IllegalArgumentException(MessageFormat.format("Parameter min ({0}) cannot be greater than max ({1})", min, max));
         } else if (val < min) {
             return min;
-        } else if (val > max) {
-            return max;
-        } else {
-            return val;
-        }
+        } else return Math.min(val, max);
     }
 
     /**
@@ -1663,11 +1659,7 @@
             throw new IllegalArgumentException(MessageFormat.format("Parameter min ({0}) cannot be greater than max ({1})", min, max));
         } else if (val < min) {
             return min;
-        } else if (val > max) {
-            return max;
-        } else {
-            return val;
-        }
+        } else return Math.min(val, max);
     }
 
     /**
@@ -1761,7 +1753,7 @@
         int bPos = version.indexOf('b');
         int pPos = version.indexOf('+');
         try {
-            return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1, version.length()));
+            return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1));
         } catch (NumberFormatException e) {
             Logging.trace(e);
             return 0;
@@ -1827,7 +1819,7 @@
 
     /**
      * Determines if a class can be found for the given name.
-     * @param className class nmae to find
+     * @param className class name to find
      * @return {@code true} if the class can be found, {@code false} otherwise
      * @since 17692
      */
Index: test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java
--- a/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java	(revision 18694)
+++ b/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java	(date 1679264631298)
@@ -6,16 +6,15 @@
 import static org.junit.jupiter.api.Assertions.assertNotEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
+import java.util.Collections;
+import java.util.HashSet;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-import java.util.Collections;
-import java.util.HashSet;
-
 /**
  * Some unit test cases for basic tag management on {@link OsmPrimitive}. Uses
  * {@link Node} for the tests, {@link OsmPrimitive} is abstract.
@@ -192,9 +191,6 @@
     private void testGetKey(OsmPrimitive p, String key, String value) {
         assertEquals(value != null, p.hasKey(key));
         assertEquals(value != null, p.getKeys().containsKey(key));
-        assertEquals(value != null, p.getKeys().keySet().contains(key));
         assertEquals(value, p.get(key));
-        assertEquals(value, p.getKeys().get(key));
     }
-
 }
Index: test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java b/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
--- a/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java	(revision 18694)
+++ b/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java	(date 1679264631298)
@@ -6,7 +6,6 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
@@ -14,14 +13,13 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
-
-import org.junit.jupiter.api.Test;
 import org.xml.sax.SAXException;
 
 /**
@@ -38,7 +36,7 @@
      */
     public static GpxData parseGpxData(String filename) throws IOException, SAXException {
         final GpxData result;
-        try (FileInputStream in = new FileInputStream(new File(filename))) {
+        try (FileInputStream in = new FileInputStream(filename)) {
             GpxReader reader = new GpxReader(in);
             assertTrue(reader.parse(false));
             result = reader.getGpxData();
Index: test/unit/org/openstreetmap/josm/testutils/mockers/EDTAssertionMocker.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/test/unit/org/openstreetmap/josm/testutils/mockers/EDTAssertionMocker.java b/test/unit/org/openstreetmap/josm/testutils/mockers/EDTAssertionMocker.java
--- a/test/unit/org/openstreetmap/josm/testutils/mockers/EDTAssertionMocker.java	(revision 18694)
+++ b/test/unit/org/openstreetmap/josm/testutils/mockers/EDTAssertionMocker.java	(date 1679264631302)
@@ -1,11 +1,10 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.testutils.mockers;
 
-import org.openstreetmap.josm.gui.util.GuiHelper;
-
 import mockit.Invocation;
 import mockit.Mock;
 import mockit.MockUp;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 
 /**
  * MockUp that, when applied, should cause calls to the EDT which would normally swallow generated
@@ -16,7 +15,7 @@
     static void handleEDTException(final Invocation invocation, final Throwable t) throws Throwable {
         final Throwable cause = t.getCause();
         if (cause instanceof AssertionError) {
-            throw (AssertionError) cause;
+            throw cause;
         }
 
         invocation.proceed(t);
