diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListener.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListener.java index 0f77fbc..78f3927 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListener.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListener.java @@ -22,7 +22,7 @@ import org.openstreetmap.josm.tools.Destroyable; */ public final class DownloadListener implements DataSourceListener, Destroyable { - private WeakReference ds; + private final WeakReference ds; private static final Collection LISTENERS = new HashSet<>(); public DownloadListener(DataSet dataSet) { diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java index 403fde7..5a03bc1 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java @@ -226,7 +226,7 @@ public class MapWithAILayer extends OsmDataLayer implements ActiveLayerChangeLis return continuousDownload; } - private class ContinuousDownloadAction extends AbstractAction implements LayerAction { + private static class ContinuousDownloadAction extends AbstractAction implements LayerAction { private static final long serialVersionUID = -3528632887550700527L; private final MapWithAILayer layer; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveAction.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveAction.java index 8a20358..b93523d 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveAction.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveAction.java @@ -74,8 +74,8 @@ public class MapWithAIMoveAction extends JosmAction { } final Collection selected = limitCollection(ds, maxAddition); final OsmDataLayer editLayer = getOsmDataLayer(); - if (editLayer != null && !selected.isEmpty() - && (MapWithAIDataUtils.getAddedObjects() < maxAddition * MAX_ADD_MULTIPLIER) + if ((editLayer != null && !selected.isEmpty() + && (MapWithAIDataUtils.getAddedObjects() < maxAddition * MAX_ADD_MULTIPLIER)) || (maxAddition == 0 && ExpertToggleAction.isExpert())) { final MapWithAIAddCommand command = new MapWithAIAddCommand(mapWithAI, editLayer, selected); UndoRedoHandler.getInstance().add(command); @@ -88,7 +88,7 @@ public class MapWithAIMoveAction extends JosmAction { } } - private void createTooManyAdditionsNotification(int maxAddition) { + private static void createTooManyAdditionsNotification(int maxAddition) { Notification tooMany = new Notification(); tooMany.setIcon(JOptionPane.WARNING_MESSAGE); tooMany.setDuration(Notification.TIME_DEFAULT); diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java index 011b394..e9a0026 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java @@ -102,8 +102,8 @@ public class RoutingIslandsTest extends Test { errors.add(TestError.builder(this, SEVERITY_MAP.get(LONELY_WAY), LONELY_WAY).primitives(way) .message(tr("MapWithAI (experimental)"), marktr("Routable way not connected to other ways")) .build()); - } else if (((ValidatorPrefHelper.PREF_OTHER.get() || ValidatorPrefHelper.PREF_OTHER_UPLOAD.get() - || !Severity.OTHER.equals(SEVERITY_MAP.get(ROUTING_ISLAND)))) && !isBeforeUpload) { + } else if ((ValidatorPrefHelper.PREF_OTHER.get() || ValidatorPrefHelper.PREF_OTHER_UPLOAD.get() + || !Severity.OTHER.equals(SEVERITY_MAP.get(ROUTING_ISLAND))) && !isBeforeUpload) { if (way.hasKey(HIGHWAY)) { potentialHighways.add(way); } else if (way.hasKey(WATERWAY)) { @@ -395,7 +395,7 @@ public class RoutingIslandsTest extends Test { */ public static Node firstNode(Way way, String transportType) { Integer oneway = isOneway(way, transportType); - Node node = (Integer.valueOf(-1).equals(oneway)) ? way.lastNode() : way.firstNode(); + Node node = Integer.valueOf(-1).equals(oneway) ? way.lastNode() : way.firstNode(); Map accessValues = getDefaultAccessTags(way); boolean accessible = Access.getPositiveAccessValues() @@ -413,7 +413,7 @@ public class RoutingIslandsTest extends Test { */ public static Node lastNode(Way way, String transportType) { Integer oneway = isOneway(way, transportType); - Node node = (Integer.valueOf(-1).equals(oneway)) ? way.firstNode() : way.lastNode(); + Node node = Integer.valueOf(-1).equals(oneway) ? way.firstNode() : way.lastNode(); Map accessValues = getDefaultAccessTags(way); boolean accessible = Access.getPositiveAccessValues() .contains(accessValues.getOrDefault(transportType, Access.AccessTags.NO.getKey())); diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/Access.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/Access.java index d2e0e12..7ba2003 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/Access.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/tools/Access.java @@ -340,8 +340,8 @@ public class Access { */ TRAIN("train", RAIL_TRANSPORT_TYPE); - private String key; - private AccessTags type; + private final String key; + private final AccessTags type; AccessTags(String key) { this.key = key;