Changeset 19050 in josm


Ignore:
Timestamp:
2024-04-22T20:59:26+02:00 (3 weeks ago)
Author:
taylor.smock
Message:

Revert most var changes from r19048, fix most new compile warnings and checkstyle issues

Also, document why various ErrorProne checks were originally disabled and fix
generic SonarLint issues.

Location:
trunk
Files:
172 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r19048 r19050  
    249249              <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
    250250              <compilerarg value="-XDignore.symbol.file"/>
    251               <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF -Xep:InlineMeSuggester:OFF" unless:set="noErrorProne"/>
     251              <!-- -XepExcludedPaths:.*/parsergen/.*: see #16860 - Resolve JavaCC using Apache Ivy -->
     252              <!-- ReferenceEquality: see #12472, fix #13230, fix #13225, fix #13228 - disable ReferenceEquality warning + partial revert of r10656 + r10659, causes too much problems -->
     253              <!-- FutureReturnValueIgnored: update to error_prone 2.0.18 (disabled on purpose?) -->
     254              <!-- JdkObsolete: see #11924 - see #15560 - support jdk10+ in build.xml, update to proguard 6.0beta1 and error_prone 2.1.2 (disabled due to crashes) -->
     255              <!-- EqualsGetClass, UndefinedEquals: see #16498 - update to error_prone 2.3.2-20180817.184126-35 to test JDK 12 compatibility. (disabled due to crashes?) -->
     256              <!-- BadImport, AnnotateFormatMethod: see #17516 - update to error-prone 2.3.5-SNAPSHOT plus following patches for Java 13 compatibility (disabled due to crashes?) -->
     257              <!-- JavaUtilDate, DoNotCallSuggester, BanSerializableRead: see #19724 - update to error-prone 2.5.1, checkstyle 8.36, spotbugs 4.2.1 (disabled due to crashes?) -->
     258              <!-- InlineMeSuggester: See #20522 - Disable https://errorprone.info/bugpattern/InlineMeSuggester (maybe it crashed?) -->
     259              <!-- LongDoubleConversion: Disable due to conflicting with Sonar settings -->
     260              <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF -Xep:InlineMeSuggester:OFF -Xep:LongDoubleConversion:OFF" unless:set="noErrorProne"/>
    252261              <compilerarg line="-Xmaxwarns 1000"/>
    253262              <compilerarg value="-Xplugin:semanticdb -sourceroot:@{srcdir} -targetroot:${build.dir}/semanticdb" if:set="lsif" />
  • trunk/scripts/TagInfoExtract.java

    r18801 r19050  
    11// License: GPL. For details, see LICENSE file.
     2
    23import java.awt.Graphics2D;
    34import java.awt.image.BufferedImage;
     
    3233
    3334import javax.imageio.ImageIO;
    34 import jakarta.json.Json;
    35 import jakarta.json.JsonArrayBuilder;
    36 import jakarta.json.JsonObjectBuilder;
    37 import jakarta.json.JsonWriter;
    38 import jakarta.json.stream.JsonGenerator;
    3935
    4036import org.openstreetmap.josm.actions.DeleteAction;
     
    8581import org.xml.sax.SAXException;
    8682
     83import jakarta.json.Json;
     84import jakarta.json.JsonArrayBuilder;
     85import jakarta.json.JsonObjectBuilder;
     86import jakarta.json.JsonWriter;
     87import jakarta.json.stream.JsonGenerator;
     88
    8789/**
    8890 * Extracts tag information for the taginfo project.
     
    163165    }
    164166
    165     private static class Options {
     167    private static final class Options {
    166168        Mode mode;
    167169        int josmSvnRevision = Version.getInstance().getVersion();
     
    314316    }
    315317
    316     private class ExternalPresets extends Presets {
     318    private final class ExternalPresets extends Presets {
    317319
    318320        @Override
     
    341343    }
    342344
    343     private class StyleSheet extends Extractor {
     345    private final class StyleSheet extends Extractor {
    344346        private MapCSSStyleSource styleSource;
    345347
  • trunk/scripts/TaggingPresetSchemeWikiGenerator.java

    r18801 r19050  
    6464    }
    6565
    66     private static class TaggingNamespaceContext implements NamespaceContext {
     66    private static final class TaggingNamespaceContext implements NamespaceContext {
    6767        @Override
    6868        public String getNamespaceURI(String prefix) {
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r19048 r19050  
    1515import java.time.Year;
    1616import java.time.ZoneOffset;
     17import java.util.Collection;
    1718import java.util.Collections;
    1819import java.util.List;
     
    2627import javax.swing.JScrollPane;
    2728
     29import org.openstreetmap.josm.data.coor.LatLon;
     30import org.openstreetmap.josm.data.imagery.DefaultLayer;
    2831import org.openstreetmap.josm.data.imagery.ImageryInfo;
    2932import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    6063        SelectWmsLayersDialog(WMSLayerTree tree, JComboBox<String> formats) {
    6164            super(MainApplication.getMainFrame(), tr("Select WMS layers"), tr("Add layers"), tr("Cancel"));
    62             final var scrollPane = new JScrollPane(tree.getLayerTree());
     65            final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
    6366            scrollPane.setPreferredSize(new Dimension(400, 400));
    64             final var panel = new JPanel(new GridBagLayout());
     67            final JPanel panel = new JPanel(new GridBagLayout());
    6568            panel.add(scrollPane, GBC.eol().fill());
    6669            panel.add(formats, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     
    8285
    8386        // change toolbar icon from if specified
    84         var icon = info.getIcon();
     87        String icon = info.getIcon();
    8588        if (icon != null) {
    8689            new ImageProvider(icon).setOptional(true).getResourceAsync(result -> {
     
    101104        try {
    102105            if (info.getUrl() != null && info.getUrl().contains("{time}")) {
    103                 final var instant = Year.now(ZoneOffset.UTC).atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant().toString();
    104                 final var example = String.join("/", instant, instant);
    105                 final var initialSelectionValue = info.getDate() != null ? info.getDate() : example;
    106                 final var userDate = JOptionPane.showInputDialog(MainApplication.getMainFrame(),
     106                final String instant = Year.now(ZoneOffset.UTC).atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant().toString();
     107                final String example = String.join("/", instant, instant);
     108                final String initialSelectionValue = info.getDate() != null ? info.getDate() : example;
     109                final String userDate = JOptionPane.showInputDialog(MainApplication.getMainFrame(),
    107110                        tr("Time filter for \"{0}\" such as \"{1}\"", info.getName(), example),
    108111                        initialSelectionValue);
     
    124127                // specify which layer to use
    125128                if (Utils.isEmpty(info.getDefaultLayers())) {
    126                     var tileSource = new WMTSTileSource(info);
    127                     var layerId = tileSource.userSelectLayer();
     129                    WMTSTileSource tileSource = new WMTSTileSource(info);
     130                    DefaultLayer layerId = tileSource.userSelectLayer();
    128131                    if (layerId != null) {
    129                         var copy = new ImageryInfo(info);
     132                        ImageryInfo copy = new ImageryInfo(info);
    130133                        copy.setDefaultLayers(Collections.singletonList(layerId));
    131                         var layerName = tileSource.getLayers().stream()
     134                        String layerName = tileSource.getLayers().stream()
    132135                                .filter(x -> x.getIdentifier().equals(layerId.getLayerName()))
    133136                                .map(Layer::getUserTitle)
     
    163166        ImageryLayer layer = null;
    164167        try {
    165             final var infoToAdd = convertImagery(info);
     168            final ImageryInfo infoToAdd = convertImagery(info);
    166169            if (infoToAdd != null) {
    167170                layer = ImageryLayer.create(infoToAdd);
     
    205208
    206209    private static LayerSelection askToSelectLayers(WMSImagery wms) {
    207         final var tree = new WMSLayerTree();
    208 
    209         var wmsFormats = wms.getFormats();
    210         final var formats = new JComboBox<String>(wmsFormats.toArray(new String[0]));
     210        final WMSLayerTree tree = new WMSLayerTree();
     211
     212        Collection<String> wmsFormats = wms.getFormats();
     213        final JComboBox<String> formats = new JComboBox<>(wmsFormats.toArray(new String[0]));
    211214        formats.setSelectedItem(wms.getPreferredFormat());
    212215        formats.setToolTipText(tr("Select image format for WMS layer"));
    213216
    214         var checkBounds = new JCheckBox(tr("Show only layers for current view"), true);
     217        JCheckBox checkBounds = new JCheckBox(tr("Show only layers for current view"), true);
    215218        Runnable updateTree = () -> {
    216             var latLon = checkBounds.isSelected() && MainApplication.isDisplayingMapView()
     219            LatLon latLon = checkBounds.isSelected() && MainApplication.isDisplayingMapView()
    217220                    ? MainApplication.getMap().mapView.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter())
    218221                    : null;
     
    225228
    226229        if (!GraphicsEnvironment.isHeadless()) {
    227             var dialog = new ExtendedDialog(MainApplication.getMainFrame(),
     230            ExtendedDialog dialog = new ExtendedDialog(MainApplication.getMainFrame(),
    228231                    tr("Select WMS layers"), tr("Add layers"), tr("Cancel"));
    229             final var scrollPane = new JScrollPane(tree.getLayerTree());
     232            final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
    230233            scrollPane.setPreferredSize(new Dimension(400, 400));
    231             final var panel = new JPanel(new GridBagLayout());
     234            final JPanel panel = new JPanel(new GridBagLayout());
    232235            panel.add(scrollPane, GBC.eol().fill());
    233236            panel.add(checkBounds, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     
    281284        CheckParameterUtil.ensureThat(ImageryType.WMS_ENDPOINT == info.getImageryType(), "wms_endpoint imagery type expected");
    282285        // We need to get the URL with {apikey} replaced. See #22642.
    283         final var tileSource = new TemplatedWMSTileSource(info, ProjectionRegistry.getProjection());
    284         final var wms = new WMSImagery(tileSource.getBaseUrl(), info.getCustomHttpHeaders());
    285         var selection = choice.apply(wms);
     286        final TemplatedWMSTileSource tileSource = new TemplatedWMSTileSource(info, ProjectionRegistry.getProjection());
     287        final WMSImagery wms = new WMSImagery(tileSource.getBaseUrl(), info.getCustomHttpHeaders());
     288        LayerSelection selection = choice.apply(wms);
    286289        if (selection == null) {
    287290            return null;
    288291        }
    289292
    290         final var url = wms.buildGetMapUrl(
     293        final String url = wms.buildGetMapUrl(
    291294                selection.layers.stream().map(LayerDetails::getName).collect(Collectors.toList()),
    292295                (List<String>) null,
     
    295298                );
    296299
    297         var selectedLayers = selection.layers.stream()
     300        String selectedLayers = selection.layers.stream()
    298301                .map(LayerDetails::getName)
    299302                .collect(Collectors.joining(", "));
    300303        // Use full copy of original Imagery info to copy all attributes. Only overwrite what's different
    301         var ret = new ImageryInfo(info);
     304        ImageryInfo ret = new ImageryInfo(info);
    302305        ret.setUrl(url);
    303306        ret.setImageryType(ImageryType.WMS);
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r19048 r19050  
    88import java.awt.event.ActionEvent;
    99import java.awt.event.KeyEvent;
     10import java.awt.geom.Area;
    1011import java.util.ArrayList;
    1112import java.util.Collection;
     
    2223import org.openstreetmap.josm.data.DataSource;
    2324import org.openstreetmap.josm.data.conflict.Conflict;
     25import org.openstreetmap.josm.data.osm.DataSet;
    2426import org.openstreetmap.josm.data.osm.IPrimitive;
    2527import org.openstreetmap.josm.data.osm.OsmData;
     
    3234import org.openstreetmap.josm.gui.MapView;
    3335import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener;
     36import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
    3437import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    3538import org.openstreetmap.josm.gui.dialogs.ValidatorDialog.ValidatorBoundingXYVisitor;
     
    143146     */
    144147    public static void zoomTo(Collection<? extends IPrimitive> sel) {
    145         final var bboxCalculator = new BoundingXYVisitor();
     148        BoundingXYVisitor bboxCalculator = new BoundingXYVisitor();
    146149        bboxCalculator.computeBoundingBox(sel);
    147150        if (bboxCalculator.getBounds() != null) {
     
    241244    public void autoScale() {
    242245        if (MainApplication.isDisplayingMapView()) {
    243             final var mapView = MainApplication.getMap().mapView;
     246            MapView mapView = MainApplication.getMap().mapView;
    244247            switch (mode) {
    245248            case PREVIOUS:
     
    309312    private void modeLayer(BoundingXYVisitor v) {
    310313        // try to zoom to the first selected layer
    311         final var l = getFirstSelectedLayer();
     314        Layer l = getFirstSelectedLayer();
    312315        if (l == null)
    313316            return;
     
    324327            }
    325328        } else {
    326             final var conflictDialog = MainApplication.getMap().conflictDialog;
     329            ConflictDialog conflictDialog = MainApplication.getMap().conflictDialog;
    327330            Conflict<? extends IPrimitive> c = conflictDialog.getSelectedConflict();
    328331            if (c != null) {
     
    356359        }
    357360        Bounds bbox = null;
    358         final var dataset = getLayerManager().getActiveDataSet();
     361        final DataSet dataset = getLayerManager().getActiveDataSet();
    359362        if (dataset != null) {
    360363            List<DataSource> dataSources = new ArrayList<>(dataset.getDataSources());
     
    369372                } else {
    370373                    lastZoomArea = -1;
    371                     final var sourceArea = getLayerManager().getActiveDataSet().getDataSourceArea();
     374                    Area sourceArea = getLayerManager().getActiveDataSet().getDataSourceArea();
    372375                    if (sourceArea != null) {
    373376                        bbox = new Bounds(sourceArea.getBounds2D());
  • trunk/src/org/openstreetmap/josm/actions/DownloadOsmInViewAction.java

    r19048 r19050  
    3737    @Override
    3838    public void actionPerformed(ActionEvent e) {
    39         final var bounds = MainApplication.getMap().mapView.getRealBounds();
    40         final var task = new DownloadOsmInViewTask();
     39        final Bounds bounds = MainApplication.getMap().mapView.getRealBounds();
     40        DownloadOsmInViewTask task = new DownloadOsmInViewTask();
    4141        task.setZoomAfterDownload(false);
    4242        Future<?> future = task.download(bounds);
     
    5555    }
    5656
    57     private static class DownloadOsmInViewTask extends DownloadOsmTask {
     57    private static final class DownloadOsmInViewTask extends DownloadOsmTask {
    5858        Future<?> download(Bounds downloadArea) {
    5959            return download(new DownloadTask(new DownloadParams(), new BoundingBoxDownloader(downloadArea), null, false), downloadArea);
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r19048 r19050  
    210210
    211211        public List<Node> getNodes() {
    212             final var nodes = new ArrayList<Node>();
     212            List<Node> nodes = new ArrayList<>();
    213213            for (WayInPolygon way : this.ways) {
    214214                //do not add the last node as it will be repeated in the next way
    215215                if (way.insideToTheRight) {
    216                     for (var pos = 0; pos < way.way.getNodesCount() - 1; pos++) {
     216                    for (int pos = 0; pos < way.way.getNodesCount() - 1; pos++) {
    217217                        nodes.add(way.way.getNode(pos));
    218218                    }
     
    343343         */
    344344        private static double getAngle(Node n1, Node n2, Node n3) {
    345             final var en1 = n1.getEastNorth();
    346             final var en2 = n2.getEastNorth();
    347             final var en3 = n3.getEastNorth();
     345            EastNorth en1 = n1.getEastNorth();
     346            EastNorth en2 = n2.getEastNorth();
     347            EastNorth en3 = n3.getEastNorth();
    348348            double angle = Math.atan2(en3.getY() - en1.getY(), en3.getX() - en1.getX()) -
    349349                    Math.atan2(en2.getY() - en1.getY(), en2.getX() - en1.getX());
     
    362362         */
    363363        public WayInPolygon walk() {
    364             final var headNode = getHeadNode();
    365             final var prevNode = getPrevNode();
     364            Node headNode = getHeadNode();
     365            Node prevNode = getPrevNode();
    366366
    367367            double headAngle = Math.atan2(headNode.getEastNorth().east() - prevNode.getEastNorth().east(),
     
    371371            //find best next way
    372372            WayInPolygon bestWay = null;
    373             var bestWayReverse = false;
     373            boolean bestWayReverse = false;
    374374
    375375            for (WayInPolygon way : availableWays) {
     
    418418         */
    419419        public WayInPolygon leftComingWay() {
    420             final var headNode = getHeadNode();
    421             final var prevNode = getPrevNode();
     420            Node headNode = getHeadNode();
     421            Node prevNode = getPrevNode();
    422422
    423423            WayInPolygon mostLeft = null; // most left way connected to head node
    424             var comingToHead = false; // true if candidate come to head node
     424            boolean comingToHead = false; // true if candidate come to head node
    425425            double angle = 2*Math.PI;
    426426
     
    649649        }
    650650
    651         var hasChanges = false;
    652 
    653         final var allStartingWays = new ArrayList<Way>();
    654         final var innerStartingWays = new ArrayList<Way>();
    655         final var outerStartingWays = new ArrayList<Way>();
     651        boolean hasChanges = false;
     652
     653        List<Way> allStartingWays = new ArrayList<>();
     654        List<Way> innerStartingWays = new ArrayList<>();
     655        List<Way> outerStartingWays = new ArrayList<>();
    656656
    657657        for (Multipolygon area : areas) {
     
    721721        if (discardedWays.stream().anyMatch(w -> !w.isNew())) {
    722722            for (AssembledPolygon ring : boundaries) {
    723                 for (var k = 0; k < ring.ways.size(); k++) {
     723                for (int k = 0; k < ring.ways.size(); k++) {
    724724                    WayInPolygon ringWay = ring.ways.get(k);
    725725                    Way older = keepOlder(ringWay.way, oldestWayMap, discardedWays);
    726726
    727727                    if (ringWay.way != older) {
    728                         final var repl = new WayInPolygon(older, ringWay.insideToTheRight);
     728                        WayInPolygon repl = new WayInPolygon(older, ringWay.insideToTheRight);
    729729                        ring.ways.set(k, repl);
    730730                    }
     
    769769        // Delete the discarded inner ways
    770770        if (!discardedWays.isEmpty()) {
    771             final var deleteCmd = DeleteCommand.delete(discardedWays, true);
     771            Command deleteCmd = DeleteCommand.delete(discardedWays, true);
    772772            if (deleteCmd != null) {
    773773                cmds.add(deleteCmd);
     
    796796    private Way keepOlder(Way way, Map<Node, Way> oldestWayMap, List<Way> discardedWays) {
    797797        Way oldest = null;
    798         for (var n : way.getNodes()) {
    799             final var orig = oldestWayMap .get(n);
     798        for (Node n : way.getNodes()) {
     799            Way orig = oldestWayMap .get(n);
    800800            if (orig != null && (oldest == null || oldest.getUniqueId() > orig.getUniqueId())
    801801                    && discardedWays.contains(orig)) {
     
    830830        }
    831831
    832         final var wayTags = TagCollection.unionOfAllPrimitives(ways);
     832        TagCollection wayTags = TagCollection.unionOfAllPrimitives(ways);
    833833        try {
    834834            cmds.addAll(CombinePrimitiveResolverDialog.launchIfNecessary(wayTags, ways, ways));
     
    847847     */
    848848    private boolean removeDuplicateNodes(List<Way> ways) {
    849         final var nodeMap = new TreeMap<Node, Node>(new NodePositionComparator());
    850         var totalWaysModified = 0;
     849        Map<Node, Node> nodeMap = new TreeMap<>(new NodePositionComparator());
     850        int totalWaysModified = 0;
    851851
    852852        for (Way way : ways) {
     
    855855            }
    856856
    857             final var newNodes = new ArrayList<Node>();
     857            List<Node> newNodes = new ArrayList<>();
    858858            Node prevNode = null;
    859             var modifyWay = false;
     859            boolean modifyWay = false;
    860860
    861861            for (Node node : way.getNodes()) {
    862                 var representator = nodeMap.get(node);
     862                Node representator = nodeMap.get(node);
    863863                if (representator == null) {
    864864                    //new node
     
    923923        cmds.clear();
    924924        if (addUndoRedo && !executedCmds.isEmpty()) {
    925             final var ur = UndoRedoHandler.getInstance();
     925            UndoRedoHandler ur = UndoRedoHandler.getInstance();
    926926            if (executedCmds.size() == 1) {
    927927                ur.add(executedCmds.getFirst(), false);
     
    945945        Map<Way, Way> nextWayMap = new HashMap<>();
    946946
    947         for (var pos = 0; pos < parts.size(); pos++) {
     947        for (int pos = 0; pos < parts.size(); pos++) {
    948948
    949949            if (!parts.get(pos).lastNode().equals(parts.get((pos + 1) % parts.size()).firstNode()))
     
    956956        Way topWay = null;
    957957        Node topNode = null;
    958         var topIndex = 0;
     958        int topIndex = 0;
    959959        double minY = Double.POSITIVE_INFINITY;
    960960
    961961        for (Way way : parts) {
    962             for (var pos = 0; pos < way.getNodesCount(); pos++) {
    963                 final var node = way.getNode(pos);
     962            for (int pos = 0; pos < way.getNodesCount(); pos++) {
     963                Node node = way.getNode(pos);
    964964
    965965                if (node.getEastNorth().getY() < minY) {
     
    996996            for (Way way : parts) {
    997997                if (way.firstNode().equals(headNode)) {
    998                     final var nextNode = way.getNode(1);
     998                    Node nextNode = way.getNode(1);
    999999
    10001000                    if (topWay == null || !Geometry.isToTheRightSideOfLine(prevNode, headNode, bestWayNextNode, nextNode)) {
     
    10081008                if (way.lastNode().equals(headNode)) {
    10091009                    //end adjacent to headNode
    1010                     final var nextNode = way.getNode(way.getNodesCount() - 2);
     1010                    Node nextNode = way.getNode(way.getNodesCount() - 2);
    10111011
    10121012                    if (topWay == null || !Geometry.isToTheRightSideOfLine(prevNode, headNode, bestWayNextNode, nextNode)) {
     
    10201020        } else {
    10211021            //node is inside way - pick the clockwise going end.
    1022             final var prev = topWay.getNode(topIndex - 1);
    1023             final var next = topWay.getNode(topIndex + 1);
     1022            Node prev = topWay.getNode(topIndex - 1);
     1023            Node next = topWay.getNode(topIndex + 1);
    10241024
    10251025            //there will be no parallel segments in the middle of way, so all fine.
     
    10271027        }
    10281028
    1029         var curWay = topWay;
     1029        Way curWay = topWay;
    10301030        boolean curWayInsideToTheRight = wayClockwise ^ isInner;
    10311031        List<WayInPolygon> result = new ArrayList<>();
     
    10351035
    10361036            //add cur way
    1037             final var resultWay = new WayInPolygon(curWay, curWayInsideToTheRight);
     1037            WayInPolygon resultWay = new WayInPolygon(curWay, curWayInsideToTheRight);
    10381038            result.add(resultWay);
    10391039
    10401040            //process next way
    1041             final var nextWay = nextWayMap.get(curWay);
    1042             final var prevNode = curWay.getNode(curWay.getNodesCount() - 2);
    1043             final var headNode = curWay.lastNode();
    1044             final var nextNode = nextWay.getNode(1);
     1041            Way nextWay = nextWayMap.get(curWay);
     1042            Node prevNode = curWay.getNode(curWay.getNodesCount() - 2);
     1043            Node headNode = curWay.lastNode();
     1044            Node nextNode = nextWay.getNode(1);
    10451045
    10461046            if (nextWay == topWay) {
     
    10681068            //                       |
    10691069
    1070             var intersectionCount = 0;
     1070            int intersectionCount = 0;
    10711071
    10721072            for (Way wayA : parts) {
     
    10781078                if (wayA.lastNode().equals(headNode)) {
    10791079
    1080                     final var wayB = nextWayMap.get(wayA);
     1080                    Way wayB = nextWayMap.get(wayA);
    10811081
    10821082                    //test if wayA is opposite wayB relative to curWay and nextWay
    10831083
    1084                     final var wayANode = wayA.getNode(wayA.getNodesCount() - 2);
    1085                     final var wayBNode = wayB.getNode(1);
     1084                    Node wayANode = wayA.getNode(wayA.getNodesCount() - 2);
     1085                    Node wayBNode = wayB.getNode(1);
    10861086
    10871087                    boolean wayAToTheRight = Geometry.isToTheRightSideOfLine(prevNode, headNode, nextNode, wayANode);
     
    11171117     */
    11181118    private static void revertDuplicateTwoNodeWays(List<WayInPolygon> parts) {
    1119         for (var i = 0; i < parts.size(); i++) {
     1119        for (int i = 0; i < parts.size(); i++) {
    11201120            WayInPolygon w1 = parts.get(i);
    11211121            if (w1.way.getNodesCount() != 2)
     
    11411141    private List<Way> splitWayOnNodes(Way way, Set<Node> nodes, Map<Node, Way> oldestWayMap) {
    11421142
    1143         final var result = new ArrayList<Way>();
     1143        List<Way> result = new ArrayList<>();
    11441144        List<List<Node>> chunks = buildNodeChunks(way, nodes);
    11451145
    11461146        if (chunks.size() > 1) {
    1147             final var split = SplitWayCommand.splitWay(way, chunks,
     1147            SplitWayCommand split = SplitWayCommand.splitWay(way, chunks,
    11481148                    Collections.emptyList(), SplitWayCommand.Strategy.keepFirstChunk());
    11491149
     
    11591159                if (!way.isNew() && result.size() > 1) {
    11601160                    for (Way part : result) {
    1161                         final var n = part.firstNode();
    1162                         final var old = oldestWayMap.get(n);
     1161                        Node n = part.firstNode();
     1162                        Way old = oldestWayMap.get(n);
    11631163                        if (old == null || old.getUniqueId() > way.getUniqueId()) {
    11641164                            oldestWayMap.put(n, way);
     
    12311231
    12321232        //TODO: bad performance for deep nestings...
    1233         final var result = new ArrayList<PolygonLevel>();
     1233        List<PolygonLevel> result = new ArrayList<>();
    12341234
    12351235        for (AssembledPolygon outerWay : boundaryWays) {
    12361236
    1237             var outerGood = true;
    1238             final var innerCandidates = new ArrayList<AssembledPolygon>();
     1237            boolean outerGood = true;
     1238            List<AssembledPolygon> innerCandidates = new ArrayList<>();
    12391239
    12401240            for (AssembledPolygon innerWay : boundaryWays) {
     
    12561256
    12571257            //add new outer polygon
    1258             final var pol = new AssembledMultipolygon(outerWay);
    1259             final var polLev = new PolygonLevel(pol, level);
     1258            AssembledMultipolygon pol = new AssembledMultipolygon(outerWay);
     1259            PolygonLevel polLev = new PolygonLevel(pol, level);
    12601260
    12611261            //process inner ways
     
    12881288        // This seems to appear when is apply over invalid way like #9911 test-case
    12891289        // Remove all of these way to make the next work.
    1290         final var cleanMultigonWays = new ArrayList<WayInPolygon>();
     1290        List<WayInPolygon> cleanMultigonWays = new ArrayList<>();
    12911291        for (WayInPolygon way: multigonWays) {
    12921292            if (way.way.getNodesCount() != 2 || !way.way.isClosed())
    12931293                cleanMultigonWays.add(way);
    12941294        }
    1295         final var traverser = new WayTraverser(cleanMultigonWays);
    1296         final var result = new ArrayList<AssembledPolygon>();
     1295        WayTraverser traverser = new WayTraverser(cleanMultigonWays);
     1296        List<AssembledPolygon> result = new ArrayList<>();
    12971297
    12981298        WayInPolygon startWay;
    12991299        while ((startWay = traverser.startNewWay()) != null) {
    1300             final var path = new ArrayList<WayInPolygon>();
    1301             final var startWays = new ArrayList<WayInPolygon>();
     1300            List<WayInPolygon> path = new ArrayList<>();
     1301            List<WayInPolygon> startWays = new ArrayList<>();
    13021302            path.add(startWay);
    13031303            while (true) {
     
    13181318                if (path.get(0) == nextWay) {
    13191319                    // path is closed -> stop here
    1320                     final var ring = new AssembledPolygon(path);
     1320                    AssembledPolygon ring = new AssembledPolygon(path);
    13211321                    if (ring.getNodes().size() <= 2) {
    13221322                        // Invalid ring (2 nodes) -> remove
     
    13571357     */
    13581358    public static List<AssembledPolygon> fixTouchingPolygons(List<AssembledPolygon> polygons) {
    1359         final var newPolygons = new ArrayList<AssembledPolygon>();
     1359        List<AssembledPolygon> newPolygons = new ArrayList<>();
    13601360
    13611361        for (AssembledPolygon ring : polygons) {
    13621362            ring.reverse();
    1363             final var traverser = new WayTraverser(ring.ways);
     1363            WayTraverser traverser = new WayTraverser(ring.ways);
    13641364            WayInPolygon startWay;
    13651365
    13661366            while ((startWay = traverser.startNewWay()) != null) {
    1367                 final var simpleRingWays = new ArrayList<WayInPolygon>();
     1367                List<WayInPolygon> simpleRingWays = new ArrayList<>();
    13681368                simpleRingWays.add(startWay);
    13691369                WayInPolygon nextWay;
     
    13741374                }
    13751375                traverser.removeWays(simpleRingWays);
    1376                 final var simpleRing = new AssembledPolygon(simpleRingWays);
     1376                AssembledPolygon simpleRing = new AssembledPolygon(simpleRingWays);
    13771377                simpleRing.reverse();
    13781378                newPolygons.add(simpleRing);
     
    14111411     */
    14121412    private Multipolygon joinPolygon(AssembledMultipolygon polygon) throws UserCancelException {
    1413         final var result = new Multipolygon(joinWays(polygon.outerWay.ways));
     1413        Multipolygon result = new Multipolygon(joinWays(polygon.outerWay.ways));
    14141414
    14151415        for (AssembledPolygon pol : polygon.innerWays) {
     
    14291429
    14301430        //leave original orientation, if all paths are reverse.
    1431         var allReverse = true;
     1431        boolean allReverse = true;
    14321432        for (WayInPolygon way : ways) {
    14331433            allReverse &= !way.insideToTheRight;
     
    14401440        }
    14411441
    1442         final var joinedWay = joinOrientedWays(ways);
     1442        Way joinedWay = joinOrientedWays(ways);
    14431443
    14441444        //should not happen
     
    14621462        // the user about this.
    14631463
    1464         final var actionWays = new ArrayList<Way>(ways.size());
    1465         var oldestPos = 0;
     1464        List<Way> actionWays = new ArrayList<>(ways.size());
     1465        int oldestPos = 0;
    14661466        Way oldest = ways.get(0).way;
    14671467        for (WayInPolygon way : ways) {
     
    15111511            }
    15121512
    1513             var hasKnownOuter = false;
     1513            boolean hasKnownOuter = false;
    15141514            outerWays.clear();
    15151515            innerWays.clear();
     
    15381538            }
    15391539
    1540             final var outerWay = outerWays.get(0);
     1540            Way outerWay = outerWays.get(0);
    15411541
    15421542            //retain only selected inner ways
     
    15881588            processedInnerWays.addAll(innerWays);
    15891589
    1590             final var pol = new Multipolygon(outerWay);
     1590            Multipolygon pol = new Multipolygon(outerWay);
    15911591            pol.innerWays.addAll(innerWays);
    15921592
     
    16151615        OsmDataLayer layer = getLayerManager().getEditLayer();
    16161616        // Create new multipolygon relation and add all inner ways to it
    1617         final var newRel = new Relation();
     1617        Relation newRel = new Relation();
    16181618        newRel.put("type", "multipolygon");
    16191619        for (Way w : inner) {
     
    16501650
    16511651                cmds.add(new ChangeMembersCommand(r, members));
    1652                 final var saverel = new RelationRole(r, rm.getRole());
     1652                RelationRole saverel = new RelationRole(r, rm.getRole());
    16531653                if (!result.contains(saverel)) {
    16541654                    result.add(saverel);
     
    17011701        default:
    17021702            // Create a new relation with all previous members and (Way)outer as outer.
    1703             final var newRel = new Relation();
     1703            Relation newRel = new Relation();
    17041704            for (RelationRole r : multiouters) {
    17051705                // Add members
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r19048 r19050  
    147147
    148148        // Finally, applicableWays contains only one perfect way
    149         final var selectedWay = applicableWays.get(0);
    150         final var sel = new ArrayList<OsmPrimitive>(ds.getSelectedRelations());
     149        final Way selectedWay = applicableWays.get(0);
     150        final List<OsmPrimitive> sel = new ArrayList<>(ds.getSelectedRelations());
    151151        sel.addAll(selectedWays);
    152152        doSplitWayShowSegmentSelection(selectedWay, selectedNodes, sel);
     
    165165        if (wayChunks != null) {
    166166            final List<Way> newWays = SplitWayCommand.createNewWaysFromChunks(splitWay, wayChunks);
    167             final var wayToKeep = SplitWayCommand.Strategy.keepLongestChunk().determineWayToKeep(newWays);
     167            final Way wayToKeep = SplitWayCommand.Strategy.keepLongestChunk().determineWayToKeep(newWays);
    168168
    169169            if (ExpertToggleAction.isExpert() && !splitWay.isNew()) {
     
    211211
    212212            setButtonIcons("ok", "cancel");
    213             final var pane = new JPanel(new GridBagLayout());
     213            final JPanel pane = new JPanel(new GridBagLayout());
    214214            pane.add(new JLabel(getTitle()), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    215215            pane.add(list, GBC.eop().fill(GridBagConstraints.HORIZONTAL));
     
    225225                    final Collection<WaySegment> segments = new ArrayList<>(selected.getNodesCount() - 1);
    226226                    final Iterator<Node> it = selected.getNodes().iterator();
    227                     var previousNode = it.next();
     227                    Node previousNode = it.next();
    228228                    while (it.hasNext()) {
    229                         final var node = it.next();
     229                        final Node node = it.next();
    230230                        segments.add(WaySegment.forNodePair(selectedWay, previousNode, node));
    231231                        previousNode = node;
     
    238238
    239239        protected void setHighlightedWaySegments(Collection<WaySegment> segments) {
    240             final var ds = selectedWay.getDataSet();
     240            final DataSet ds = selectedWay.getDataSet();
    241241            if (ds != null) {
    242242                ds.setHighlightedWaySegments(segments);
     
    248248        public void setVisible(boolean visible) {
    249249            super.setVisible(visible);
    250             final var ds = selectedWay.getDataSet();
     250            final DataSet ds = selectedWay.getDataSet();
    251251            if (visible) {
    252252                DISPLAY_COUNT.incrementAndGet();
     
    337337        @Override
    338338        public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    339             final var c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
     339            final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    340340            final String name = DefaultNameFormatter.getInstance().format((Way) value);
    341341            // get rid of id from DefaultNameFormatter.decorateNameWithId()
     
    360360        // Special case - one of the selected ways touches (not cross) way that we want to split
    361361        if (selectedNodes.size() == 1) {
    362             final var n = selectedNodes.get(0);
     362            final Node n = selectedNodes.get(0);
    363363            List<Way> referredWays = n.getParentWays();
    364364            Way inTheMiddle = null;
  • trunk/src/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrector.java

    r17029 r19050  
    102102                null
    103103        );
    104         switch(ret) {
     104        switch (ret) {
    105105            case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION:
    106106            case JOptionPane.YES_OPTION:
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java

    r16611 r19050  
    172172                    String msg;
    173173                    String id = Long.toString(p.getUniqueId());
    174                     switch(p.getType()) {
     174                    switch (p.getType()) {
    175175                    case NODE: msg = tr("({0}/{1}) Loading parents of node {2}", i, children.size(), id); break;
    176176                    case WAY: msg = tr("({0}/{1}) Loading parents of way {2}", i, children.size(), id); break;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r18801 r19050  
    9191    }
    9292
    93     private static class DeleteParameters {
     93    private static final class DeleteParameters {
    9494        private DeleteMode mode;
    9595        private Node nearestNode;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r18871 r19050  
    225225
    226226    private boolean updateModifiersState(int modifiers) {
    227         boolean oldAlt = alt, oldShift = shift, oldCtrl = ctrl;
     227        boolean oldAlt = alt;
     228        boolean oldShift = shift;
     229        boolean oldCtrl = ctrl;
    228230        updateKeyModifiersEx(modifiers);
    229231        return oldAlt != alt || oldShift != shift || oldCtrl != ctrl;
     
    616618    }
    617619
    618     private class ParallelWayLayer extends AbstractMapViewPaintable {
     620    private final class ParallelWayLayer extends AbstractMapViewPaintable {
    619621        @Override
    620622        public void paint(Graphics2D g, MapView mv, Bounds bbox) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r18768 r19050  
    4444import org.openstreetmap.josm.data.osm.WaySegment;
    4545import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor;
    46 import org.openstreetmap.josm.data.osm.visitor.paint.WireframeMapRenderer;
     46import org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer;
    4747import org.openstreetmap.josm.data.preferences.BooleanProperty;
    4848import org.openstreetmap.josm.data.preferences.CachingProperty;
     
    206206        super(tr("Select mode"), "move/move", tr("Select, move, scale and rotate objects"),
    207207                Shortcut.registerShortcut("mapmode:select", tr("Mode: {0}", tr("Select mode")), KeyEvent.VK_S, Shortcut.DIRECT),
    208                 ImageProvider.getCursor("normal", "selection"));
     208                ImageProvider.getCursor(NORMAL, "selection"));
    209209        mv = mapFrame.mapView;
    210210        setHelpId(ht("/Action/Select"));
     
    316316    private Cursor getCursor(OsmPrimitive nearbyStuff) {
    317317        String c = "rect";
    318         switch(mode) {
     318        switch (mode) {
    319319        case MOVE:
    320320            if (virtualManager.hasVirtualNode()) {
     
    438438        determineMapMode(nearestPrimitive != null);
    439439
    440         switch(mode) {
     440        switch (mode) {
    441441        case ROTATE:
    442442        case SCALE:
     
    519519            return;
    520520
    521         if (mode != Mode.ROTATE && mode != Mode.SCALE && (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == 0) {
     521        if (mode != Mode.ROTATE && mode != Mode.SCALE && (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == 0) {
    522522            // button is pressed in rotate mode
    523523            return;
     
    11161116    private final transient VirtualManager virtualManager = new VirtualManager();
    11171117
    1118     private class CycleManager {
     1118    private final class CycleManager {
    11191119
    11201120        private Collection<OsmPrimitive> cycleList = Collections.emptyList();
     
    12551255    }
    12561256
    1257     private class VirtualManager {
     1257    private final class VirtualManager {
    12581258
    12591259        private Node virtualNode;
     
    12941294                    MapViewPoint p1 = mv.getState().getPointFor(wnp.a);
    12951295                    MapViewPoint p2 = mv.getState().getPointFor(wnp.b);
    1296                     if (WireframeMapRenderer.isLargeSegment(p1, p2, virtualSpace)) {
     1296                    if (AbstractMapRenderer.isLargeSegment(p1, p2, virtualSpace)) {
    12971297                        Point2D pc = new Point2D.Double((p1.getInViewX() + p2.getInViewX()) / 2, (p1.getInViewY() + p2.getInViewY()) / 2);
    12981298                        if (p.distanceSq(pc) < virtualSnapDistSq2) {
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r18871 r19050  
    8484            @Override
    8585            public Match get(String keyword, boolean caseSensitive, boolean regexSearch, PushbackTokenizer tokenizer) throws SearchParseError {
    86                 switch(keyword) {
     86                switch (keyword) {
    8787                case "inview":
    8888                    return new InView(false);
     
    291291     * Select the search result and display a status text for it.
    292292     */
    293     private static class SelectSearchReceiver implements SearchReceiver {
     293    private static final class SelectSearchReceiver implements SearchReceiver {
    294294
    295295        @Override
  • trunk/src/org/openstreetmap/josm/command/AddCommand.java

    r13173 r19050  
    7272    public String getDescriptionText() {
    7373        String msg;
    74         switch(OsmPrimitiveType.from(osm)) {
     74        switch (OsmPrimitiveType.from(osm)) {
    7575        case NODE: msg = marktr("Add node {0}"); break;
    7676        case WAY: msg = marktr("Add way {0}"); break;
  • trunk/src/org/openstreetmap/josm/command/ChangeCommand.java

    r16119 r19050  
    7878    public String getDescriptionText() {
    7979        String msg;
    80         switch(OsmPrimitiveType.from(osm)) {
     80        switch (OsmPrimitiveType.from(osm)) {
    8181        case NODE: msg = marktr("Change node {0}"); break;
    8282        case WAY: msg = marktr("Change way {0}"); break;
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r18208 r19050  
    206206            Map.Entry<String, String> entry = tags.entrySet().iterator().next();
    207207            if (Utils.isEmpty(entry.getValue())) {
    208                 switch(OsmPrimitiveType.from(primitive)) {
     208                switch (OsmPrimitiveType.from(primitive)) {
    209209                case NODE: msg = marktr("Remove \"{0}\" for node ''{1}''"); break;
    210210                case WAY: msg = marktr("Remove \"{0}\" for way ''{1}''"); break;
     
    214214                text = tr(msg, entry.getKey(), primitive.getDisplayName(DefaultNameFormatter.getInstance()));
    215215            } else {
    216                 switch(OsmPrimitiveType.from(primitive)) {
     216                switch (OsmPrimitiveType.from(primitive)) {
    217217                case NODE: msg = marktr("Set {0}={1} for node ''{2}''"); break;
    218218                case WAY: msg = marktr("Set {0}={1} for way ''{2}''"); break;
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r18801 r19050  
    250250            OsmPrimitive primitive = toDelete.iterator().next();
    251251            String msg;
    252             switch(OsmPrimitiveType.from(primitive)) {
     252            switch (OsmPrimitiveType.from(primitive)) {
    253253            case NODE: msg = marktr("Delete node {0}"); break;
    254254            case WAY: msg = marktr("Delete way {0}"); break;
     
    265265            } else {
    266266                OsmPrimitiveType t = typesToDelete.iterator().next();
    267                 switch(t) {
     267                switch (t) {
    268268                case NODE: msg = trn("Delete {0} node", "Delete {0} nodes", toDelete.size(), toDelete.size()); break;
    269269                case WAY: msg = trn("Delete {0} way", "Delete {0} ways", toDelete.size(), toDelete.size()); break;
  • trunk/src/org/openstreetmap/josm/command/PurgeCommand.java

    r18871 r19050  
    9696                    // user clears undo/redo buffer after purge
    9797                    PrimitiveData empty;
    98                     switch(osm.getType()) {
     98                    switch (osm.getType()) {
    9999                    case NODE: empty = new NodeData(); break;
    100100                    case WAY: empty = new WayData(); break;
  • trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java

    r15444 r19050  
    3636    public String getDescriptionText() {
    3737        String msg;
    38         switch(OsmPrimitiveType.from(conflict.getMy())) {
     38        switch (OsmPrimitiveType.from(conflict.getMy())) {
    3939        case NODE: msg = marktr("Set the ''modified'' flag for node {0}"); break;
    4040        case WAY: msg = marktr("Set the ''modified'' flag for way {0}"); break;
  • trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java

    r17333 r19050  
    3636    public String getDescriptionText() {
    3737        String msg;
    38         switch(OsmPrimitiveType.from(conflict.getMy())) {
     38        switch (OsmPrimitiveType.from(conflict.getMy())) {
    3939        case NODE: msg = marktr("Resolve version conflict for node {0}"); break;
    4040        case WAY: msg = marktr("Resolve version conflict for way {0}"); break;
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r17399 r19050  
    4040    private final LinkedList<CommandQueuePreciseListener> preciseListenerCommands = new LinkedList<>();
    4141
    42     private static class InstanceHolder {
     42    private static final class InstanceHolder {
    4343        static final UndoRedoHandler INSTANCE = new UndoRedoHandler();
    4444    }
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java

    r18832 r19050  
    7777            TimeUnit.SECONDS,
    7878            // make queue of LIFO type - so recently requested tiles will be loaded first (assuming that these are which user is waiting to see)
    79             new LinkedBlockingDeque<Runnable>(),
     79            new LinkedBlockingDeque<>(),
    8080            Utils.newThreadFactory("JCS-downloader-%d", Thread.NORM_PRIORITY)
    8181            );
     
    323323        }
    324324        try (InputStream fileInputStream = Files.newInputStream(file.toPath())) {
    325             cacheData = createCacheEntry(Utils.readBytesFromStream(fileInputStream));
     325            cacheData = createCacheEntry(fileInputStream.readAllBytes());
    326326            cache.put(getCacheKey(), cacheData, attributes);
    327327            return true;
     
    394394                byte[] raw;
    395395                if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
    396                     raw = Utils.readBytesFromStream(urlConn.getContent());
     396                    raw = urlConn.getContent().readAllBytes();
    397397                } else {
    398398                    raw = new byte[]{};
  • trunk/src/org/openstreetmap/josm/data/coor/conversion/LatLonParser.java

    r17787 r19050  
    6161    private static final Pattern P_DMS = Pattern.compile("^" + DMS + "$");
    6262
    63     private static class LatLonHolder {
     63    private static final class LatLonHolder {
    6464        private double lat = Double.NaN;
    6565        private double lon = Double.NaN;
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r18211 r19050  
    152152    private boolean isNotImage(Map<String, List<String>> headers, int statusCode) {
    153153        if (statusCode == 200 && headers.containsKey("Content-Type") && !headers.get("Content-Type").isEmpty()) {
    154             String contentType = headers.get("Content-Type").stream().findAny().get();
     154            String contentType = headers.get("Content-Type").stream().findAny().orElse(null);
    155155            if (contentType != null && !contentType.startsWith("image") && !MVTFile.MIMETYPE.contains(contentType.toLowerCase(Locale.ROOT))) {
    156156                Logging.warn("Image not returned for tile: " + url + " content type was: " + contentType);
     
    198198            }
    199199
    200             switch(result) {
     200            switch (result) {
    201201            case SUCCESS:
    202202                handleNoTileAtZoom();
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r18911 r19050  
    7474import org.openstreetmap.josm.tools.CheckParameterUtil;
    7575import org.openstreetmap.josm.tools.Logging;
    76 import org.openstreetmap.josm.tools.Utils;
    7776
    7877/**
     
    113112    private int cachedTileSize = -1;
    114113
    115     private static class TileMatrix {
     114    private static final class TileMatrix {
    116115        private String identifier;
    117116        private double scaleDenominator;
     
    123122    }
    124123
    125     private static class TileMatrixSetBuilder {
     124    private static final class TileMatrixSetBuilder {
    126125        // sorted by zoom level
    127126        SortedSet<TileMatrix> tileMatrix = new TreeSet<>((o1, o2) -> -1 * Double.compare(o1.scaleDenominator, o2.scaleDenominator));
     
    194193    }
    195194
    196     private static class Dimension {
     195    private static final class Dimension {
    197196        private String identifier;
    198197        private String defaultValue;
     
    454453                setCachingStrategy(CachedFile.CachingStrategy.IfModifiedSince).
    455454                getInputStream()) {
    456             byte[] data = Utils.readBytesFromStream(in);
     455            byte[] data = in.readAllBytes();
    457456            if (data.length == 0) {
    458457                cf.clear();
  • trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Exception.java

    r18723 r19050  
    5555                : "Unknown error");
    5656        if (serverMessage != null && serverMessage.containsKey("error")) {
    57             switch(serverMessage.getString("error")) {
     57            switch (serverMessage.getString("error")) {
    5858                case "invalid_request":
    5959                case "invalid_client":
  • trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java

    r18801 r19050  
    115115        //
    116116        OsmPrimitive target;
    117         switch(source.getType()) {
     117        switch (source.getType()) {
    118118        case NODE: target = source.isNew() ? new Node() : new Node(source.getId()); break;
    119119        case WAY: target = source.isNew() ? new Way() : new Way(source.getId()); break;
  • trunk/src/org/openstreetmap/josm/data/osm/OsmDataManager.java

    r18801 r19050  
    2121    }
    2222
    23     private static class InstanceHolder {
     23    private static final class InstanceHolder {
    2424        static final OsmDataManager INSTANCE = new OsmDataManager();
    2525    }
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveComparator.java

    r13803 r19050  
    5858
    5959    static <T extends IPrimitive> Comparator<T> doOrderingNodesWaysRelations() {
    60         return comparingInt(osm -> osm.getType().ordinal());
     60        return comparing(PrimitiveId::getType);
    6161    }
    6262
  • trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java

    r19048 r19050  
    2323import java.util.function.Predicate;
    2424import java.util.function.Supplier;
     25import java.util.regex.Matcher;
    2526import java.util.regex.Pattern;
    2627import java.util.regex.PatternSyntaxException;
     
    11391140                    value = Normalizer.normalize(value, Normalizer.Form.NFC);
    11401141
    1141                     final var keyMatcher = searchRegex.matcher(key);
    1142                     final var valMatcher = searchRegex.matcher(value);
     1142                    final Matcher keyMatcher = searchRegex.matcher(key);
     1143                    final Matcher valMatcher = searchRegex.matcher(value);
    11431144
    11441145                    boolean keyMatchFound = keyMatcher.find();
     
    18171818            if (!(osm instanceof Way))
    18181819                return null;
    1819             final var way = (Way) osm;
     1820            final Way way = (Way) osm;
    18201821            return (long) way.getLength();
    18211822        }
     
    19701971
    19711972            try {
    1972                 final var groupSuffix = name.substring(0, name.length() - 2); // try to remove '/*'
     1973                String groupSuffix = name.substring(0, name.length() - 2); // try to remove '/*'
    19731974                TaggingPresetMenu group = preset.group;
    19741975
     
    21782179            } else if (tokenizer.readIfEqual(Token.COLON)) {
    21792180                // see if we have a Match that takes a data parameter
    2180                 final var factory = simpleMatchFactoryMap.get(key);
     2181                SimpleMatchFactory factory = simpleMatchFactoryMap.get(key);
    21812182                if (factory != null)
    21822183                    return factory.get(key, caseSensitive, regexSearch, tokenizer);
    21832184
    2184                 final var unaryFactory = unaryMatchFactoryMap.get(key);
     2185                UnaryMatchFactory unaryFactory = unaryMatchFactoryMap.get(key);
    21852186                if (unaryFactory != null)
    21862187                    return getValidate(unaryFactory, key, tokenizer);
     
    21952196                return new BooleanMatch(key, false);
    21962197            else {
    2197                 final var factory = simpleMatchFactoryMap.get(key);
     2198                SimpleMatchFactory factory = simpleMatchFactoryMap.get(key);
    21982199                if (factory != null)
    21992200                    return factory.get(key, caseSensitive, regexSearch, null).validate();
    22002201
    2201                 final var unaryFactory = unaryMatchFactoryMap.get(key);
     2202                UnaryMatchFactory unaryFactory = unaryMatchFactoryMap.get(key);
    22022203                if (unaryFactory != null)
    22032204                    return getValidate(unaryFactory, key, null);
     
    22212222
    22222223    private static int regexFlags(boolean caseSensitive) {
    2223         var searchFlags = 0;
     2224        int searchFlags = 0;
    22242225
    22252226        // Enables canonical Unicode equivalence so that e.g. the two
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r18871 r19050  
    978978                    }
    979979
    980                     switch(m.getRole()) {
     980                    switch (m.getRole()) {
    981981                    case "from":
    982982                        if (fromWay == null) {
     
    12481248                    MapViewPath path = new MapViewPath(mapState);
    12491249                    path.appendFromEastNorth(pd.get());
    1250                     path.setWindingRule(MapViewPath.WIND_EVEN_ODD);
     1250                    path.setWindingRule(Path2D.WIND_EVEN_ODD);
    12511251                    consumer.accept(path);
    12521252                }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java

    r18211 r19050  
    6868     * above.</p>
    6969     */
    70     private static class MultipolygonRoleMatcher implements PreferenceChangedListener {
     70    private static final class MultipolygonRoleMatcher implements PreferenceChangedListener {
    7171        private final List<String> outerExactRoles = new ArrayList<>();
    7272        private final List<String> outerRolePrefixes = new ArrayList<>();
  • trunk/src/org/openstreetmap/josm/data/preferences/JosmBaseDirectories.java

    r14153 r19050  
    2626    }
    2727
    28     private static class InstanceHolder {
     28    private static final class InstanceHolder {
    2929        static final JosmBaseDirectories INSTANCE = new JosmBaseDirectories();
    3030    }
  • trunk/src/org/openstreetmap/josm/data/preferences/JosmUrls.java

    r14208 r19050  
    3636    }
    3737
    38     private static class InstanceHolder {
     38    private static final class InstanceHolder {
    3939        static final JosmUrls INSTANCE = new JosmUrls();
    4040    }
  • trunk/src/org/openstreetmap/josm/data/preferences/PreferencesReader.java

    r14441 r19050  
    168168            if (event == XMLStreamConstants.START_ELEMENT) {
    169169                String localName = parser.getLocalName();
    170                 switch(localName) {
     170                switch (localName) {
    171171                case "tag":
    172172                    StringSetting setting;
     
    240240                if (event == XMLStreamConstants.START_ELEMENT) {
    241241                    String localName = parser.getLocalName();
    242                     switch(localName) {
     242                    switch (localName) {
    243243                    case "entry":
    244244                        if (entries == null) {
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2Proj4DirGridShiftFileSource.java

    r18211 r19050  
    2929
    3030    // lazy initialization
    31     private static class InstanceHolder {
     31    private static final class InstanceHolder {
    3232        static final NTV2Proj4DirGridShiftFileSource INSTANCE = new NTV2Proj4DirGridShiftFileSource();
    3333    }
  • trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java

    r19048 r19050  
    1111import java.nio.charset.StandardCharsets;
    1212import java.nio.file.Files;
     13import java.nio.file.Path;
    1314import java.nio.file.Paths;
    1415import java.util.ArrayList;
     
    3031import org.openstreetmap.josm.cli.CLIModule;
    3132import org.openstreetmap.josm.data.Preferences;
     33import org.openstreetmap.josm.data.osm.DataSet;
    3234import org.openstreetmap.josm.data.preferences.JosmBaseDirectories;
    3335import org.openstreetmap.josm.data.preferences.JosmUrls;
     
    174176            }
    175177            this.initialize();
    176             final var fileMonitor = progressMonitorFactory.get();
     178            final ProgressMonitor fileMonitor = progressMonitorFactory.get();
    177179            fileMonitor.beginTask(tr("Processing files..."), this.input.size());
    178180            for (String inputFile : this.input) {
     
    200202     */
    201203    private static void processMapcssFile(final String inputFile) throws ParseException {
    202         final var styleSource = new MapCSSStyleSource(new File(inputFile).toURI().getPath(), inputFile, inputFile);
     204        final MapCSSStyleSource styleSource = new MapCSSStyleSource(new File(inputFile).toURI().getPath(), inputFile, inputFile);
    203205        styleSource.loadStyleSource();
    204206        if (!styleSource.getErrors().isEmpty()) {
     
    219221        // Check asserts
    220222        Config.getPref().putBoolean("validator.check_assert_local_rules", true);
    221         final var mapCSSTagChecker = new MapCSSTagChecker();
    222         final var assertionErrors = new ArrayList<String>();
     223        final MapCSSTagChecker mapCSSTagChecker = new MapCSSTagChecker();
     224        final Collection<String> assertionErrors = new ArrayList<>();
    223225        final MapCSSTagChecker.ParseResult result = mapCSSTagChecker.addMapCSS(new File(inputFile).toURI().getPath(),
    224226                assertionErrors::add);
     
    245247     */
    246248    private void processFile(final String inputFile) throws IllegalDataException, IOException {
    247         final var inputFileFile = new File(inputFile);
     249        final File inputFileFile = new File(inputFile);
    248250        final List<FileImporter> inputFileImporters = ExtensionFileFilter.getImporters().stream()
    249251                .filter(importer -> importer.acceptFile(inputFileFile)).collect(Collectors.toList());
    250         final var stopwatch = Stopwatch.createStarted();
     252        final Stopwatch stopwatch = Stopwatch.createStarted();
    251253        if (inputFileImporters.stream().noneMatch(fileImporter ->
    252254                fileImporter.importDataHandleExceptions(inputFileFile, progressMonitorFactory.get()))) {
     
    261263                    .stream().filter(layer -> inputFileFile.equals(layer.getAssociatedFile()))
    262264                    .findFirst().orElseThrow(() -> new JosmRuntimeException(tr("Could not find a layer for {0}", inputFile)));
    263             final var dataSet = dataLayer.getDataSet();
     265            final DataSet dataSet = dataLayer.getDataSet();
    264266            if (this.changeFiles.containsKey(inputFile)) {
    265                 final var changeFilesMonitor = progressMonitorFactory.get();
     267                final ProgressMonitor changeFilesMonitor = progressMonitorFactory.get();
    266268                for (String changeFile : this.changeFiles.getOrDefault(inputFile, Collections.emptyList())) {
    267                     try (var changeStream = Compression.getUncompressedFileInputStream(Paths.get(changeFile))) {
     269                    try (InputStream changeStream = Compression.getUncompressedFileInputStream(Paths.get(changeFile))) {
    268270                        dataSet.mergeFrom(OsmChangeReader.parseDataSet(changeStream, changeFilesMonitor));
    269271                    }
    270272                }
    271273            }
    272             final var path = Paths.get(outputFile);
     274            final Path path = Paths.get(outputFile);
    273275            if (path.toFile().isFile() && !Files.deleteIfExists(path)) {
    274276                Logging.error("Could not delete {0}, attempting to append", outputFile);
    275277            }
    276             final var geoJSONMapRouletteWriter = new GeoJSONMapRouletteWriter(dataSet);
     278            final GeoJSONMapRouletteWriter geoJSONMapRouletteWriter = new GeoJSONMapRouletteWriter(dataSet);
    277279            OsmValidator.initializeTests();
    278280
    279             try (var fileOutputStream = Files.newOutputStream(path)) {
     281            try (OutputStream fileOutputStream = Files.newOutputStream(path)) {
    280282                // The first writeErrors catches anything that was written, for whatever reason. This is probably never
    281283                // going to be called.
     
    346348    /**
    347349     * Initialize everything that might be needed
    348      * <p>
     350     *
    349351     * Arguments may need to be parsed first.
    350352     */
     
    367369        Logging.setLogLevel(Level.INFO);
    368370
    369         final var parser = new OptionParser("JOSM validate");
    370         final var currentInput = new AtomicReference<String>(null);
     371        OptionParser parser = new OptionParser("JOSM validate");
     372        final AtomicReference<String> currentInput = new AtomicReference<>(null);
    371373        for (Option o : Option.values()) {
    372374            if (o.requiresArgument()) {
     
    423425            break;
    424426        case LOAD_PREFERENCES:
    425             final var tempPreferences = new Preferences();
     427            final Preferences tempPreferences = new Preferences();
    426428            tempPreferences.enableSaveOnPut(false);
    427             final var config = new CustomConfigurator.XMLCommandProcessor(tempPreferences);
     429            CustomConfigurator.XMLCommandProcessor config = new CustomConfigurator.XMLCommandProcessor(tempPreferences);
    428430            try (InputStream is = Utils.openStream(new File(argument).toURI().toURL())) {
    429431                config.openAndReadXML(is);
     
    433435            final IPreferences pref = Config.getPref();
    434436            if (pref instanceof MemoryPreferences) {
    435                 final var memoryPreferences = (MemoryPreferences) pref;
     437                final MemoryPreferences memoryPreferences = (MemoryPreferences) pref;
    436438                tempPreferences.getAllSettings().forEach(memoryPreferences::putSetting);
    437439            } else {
     
    452454
    453455    private static String getHelp() {
    454         final var helpPadding = "\t                          ";
     456        final String helpPadding = "\t                          ";
    455457        // CHECKSTYLE.OFF: SingleSpaceSeparator
    456458        return tr("JOSM Validation command line interface") + "\n\n" +
  • trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java

    r19039 r19050  
    18531853                .toArray(String[]::new);
    18541854        Arrays.sort(copy);
    1855         switch(table) {
     1855        switch (table) {
    18561856        case COUNTRY_CODE_MINUS:
    18571857            countryCodeTLDsMinus = copy;
     
    18851885    public static String[] getTLDEntries(ArrayType table) {
    18861886        final String[] array;
    1887         switch(table) {
     1887        switch (table) {
    18881888        case COUNTRY_CODE_MINUS:
    18891889            array = countryCodeTLDsMinus;
     
    19431943            //            (halfwidth ideographic full stop).
    19441944            char lastChar = input.charAt(length-1); // fetch original last char
    1945             switch(lastChar) {
     1945            switch (lastChar) {
    19461946                case '.':      // "." full stop, AKA U+002E
    19471947                case '\u3002': // ideographic full stop
     
    19581958    }
    19591959
    1960     private static class IdnBugHolder {
     1960    private static final class IdnBugHolder {
    19611961        private static boolean keepsTrailingDot() {
    19621962            final String input = "a."; // must be a valid name
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r18801 r19050  
    109109        }
    110110        for (TaggingPreset p : TaggingPresets.getTaggingPresets()) {
    111             if (p.data.stream().anyMatch(i -> i instanceof Roles)) {
     111            if (p.data.stream().anyMatch(Roles.class::isInstance)) {
    112112                relationpresets.add(p);
    113113            }
     
    115115    }
    116116
    117     private static class RoleInfo {
     117    private static final class RoleInfo {
    118118        private int total;
    119119    }
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r19019 r19050  
    10471047        SwingUtilities.invokeLater(new GuiFinalizationWorker(args, proxySelector));
    10481048
    1049         if (RemoteControl.PROP_REMOTECONTROL_ENABLED.get()) {
     1049        if (Boolean.TRUE.equals(RemoteControl.PROP_REMOTECONTROL_ENABLED.get())) {
    10501050            RemoteControl.start();
    10511051        }
    10521052
    1053         if (MessageNotifier.PROP_NOTIFIER_ENABLED.get()) {
     1053        if (Boolean.TRUE.equals(MessageNotifier.PROP_NOTIFIER_ENABLED.get())) {
    10541054            MessageNotifier.start();
    10551055        }
     
    14781478
    14791479        private static void handleAutosave() {
    1480             if (AutosaveTask.PROP_AUTOSAVE_ENABLED.get()) {
     1480            if (Boolean.TRUE.equals(AutosaveTask.PROP_AUTOSAVE_ENABLED.get())) {
    14811481                AutosaveTask autosaveTask = new AutosaveTask();
    14821482                List<File> unsavedLayerFiles = autosaveTask.getUnsavedLayersFiles();
     
    15591559    }
    15601560
    1561     private static class DefaultNativeOsCallback implements NativeOsCallback {
     1561    private static final class DefaultNativeOsCallback implements NativeOsCallback {
    15621562        @Override
    15631563        public void openFiles(List<File> files) {
  • trunk/src/org/openstreetmap/josm/gui/MainFrame.java

    r18287 r19050  
    77import java.awt.Component;
    88import java.awt.ComponentOrientation;
     9import java.awt.Frame;
    910import java.awt.Image;
    1011import java.awt.Rectangle;
     
    2425import javax.swing.JFrame;
    2526import javax.swing.JPanel;
     27import javax.swing.WindowConstants;
    2628
    2729import org.openstreetmap.josm.data.UserIdentityManager;
     
    5557
    5658    protected transient WindowGeometry geometry;
    57     protected int windowState = JFrame.NORMAL;
     59    protected int windowState = Frame.NORMAL;
    5860    private final MainPanel panel;
    5961    private MainMenu menu;
     
    111113        setIconImages(l);
    112114        addWindowListener(new ExitWindowAdapter());
    113         setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
     115        setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    114116
    115117        // This listener is never removed, since the main frame exists forever.
     
    131133             geometry.remember(WindowGeometry.PREF_KEY_GUI_GEOMETRY);
    132134        }
    133         Config.getPref().putBoolean("gui.maximized", (windowState & JFrame.MAXIMIZED_BOTH) != 0);
     135        Config.getPref().putBoolean("gui.maximized", (windowState & Frame.MAXIMIZED_BOTH) != 0);
    134136    }
    135137
     
    162164    public void setMaximized(boolean maximized) {
    163165        if (maximized) {
    164             if (Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.MAXIMIZED_BOTH)) {
    165                 windowState = JFrame.MAXIMIZED_BOTH;
     166            if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
     167                windowState = Frame.MAXIMIZED_BOTH;
    166168                setExtendedState(windowState);
    167169            } else {
     
    229231    }
    230232
    231     private class WindowPositionSizeListener extends WindowAdapter implements ComponentListener {
     233    private final class WindowPositionSizeListener extends WindowAdapter implements ComponentListener {
    232234        @Override
    233235        public void windowStateChanged(WindowEvent e) {
     
    258260            Component c = e.getComponent();
    259261            if (c instanceof JFrame && c.isVisible()) {
    260                 if (windowState == JFrame.NORMAL) {
     262                if (windowState == Frame.NORMAL) {
    261263                    geometry = new WindowGeometry((JFrame) c);
    262264                } else {
  • trunk/src/org/openstreetmap/josm/gui/MainInitialization.java

    r18985 r19050  
    158158    }
    159159
    160     private static class JosmSettingsAdapter implements SettingsAdapter {
     160    private static final class JosmSettingsAdapter implements SettingsAdapter {
    161161
    162162        @Override
  • trunk/src/org/openstreetmap/josm/gui/MapMover.java

    r17333 r19050  
    77import java.awt.Point;
    88import java.awt.event.ActionEvent;
     9import java.awt.event.InputEvent;
    910import java.awt.event.KeyEvent;
    1011import java.awt.event.MouseAdapter;
     
    8889                EastNorth center = nc.getCenter();
    8990                EastNorth newcenter = nc.getEastNorth(nc.getWidth()/2+nc.getWidth()/5, nc.getHeight()/2+nc.getHeight()/5);
    90                 switch(action) {
     91                switch (action) {
    9192                case "left":
    9293                    nc.zoomTo(new EastNorth(2*center.east()-newcenter.east(), center.north()));
     
    173174    @Override
    174175    public void mouseDragged(MouseEvent e) {
    175         int offMask = MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK;
    176         boolean allowMovement = (e.getModifiersEx() & (MouseEvent.BUTTON3_DOWN_MASK | offMask)) == MouseEvent.BUTTON3_DOWN_MASK;
     176        int offMask = InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON2_DOWN_MASK;
     177        boolean allowMovement = (e.getModifiersEx() & (InputEvent.BUTTON3_DOWN_MASK | offMask)) == InputEvent.BUTTON3_DOWN_MASK;
    177178        if (PlatformManager.isPlatformOsx()) {
    178179            MapFrame map = MainApplication.getMap();
    179             int macMouseMask = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
     180            int macMouseMask = InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK;
    180181            boolean macMovement = e.getModifiersEx() == macMouseMask;
    181182            boolean allowedMode = !map.mapModeSelect.equals(map.mapMode)
     
    204205    @Override
    205206    public void mousePressed(MouseEvent e) {
    206         int offMask = MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK;
    207         int macMouseMask = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
     207        int offMask = InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON2_DOWN_MASK;
     208        int macMouseMask = InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK;
    208209        if ((e.getButton() == MouseEvent.BUTTON3 && (e.getModifiersEx() & offMask) == 0) ||
    209210                (PlatformManager.isPlatformOsx() && e.getModifiersEx() == macMouseMask)) {
     
    253254    @Override
    254255    public void mouseWheelMoved(MouseWheelEvent e) {
    255         int rotation = PROP_ZOOM_REVERSE_WHEEL.get() ? -e.getWheelRotation() : e.getWheelRotation();
     256        int rotation = Boolean.TRUE.equals(PROP_ZOOM_REVERSE_WHEEL.get()) ? -e.getWheelRotation() : e.getWheelRotation();
    256257        nc.zoomManyTimes(e.getX(), e.getY(), rotation);
    257258    }
     
    268269        // Is only the selected mouse button pressed?
    269270        if (PlatformManager.isPlatformOsx()) {
    270             if (e.getModifiersEx() == MouseEvent.CTRL_DOWN_MASK) {
     271            if (e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK) {
    271272                doMoveForDrag(e);
    272273            } else {
  • trunk/src/org/openstreetmap/josm/gui/MenuScroller.java

    r16913 r19050  
    350350    }
    351351
    352     private class MenuScrollListener implements PopupMenuListener {
     352    private final class MenuScrollListener implements PopupMenuListener {
    353353
    354354        @Override
     
    453453    }
    454454
    455     private class MouseScrollListener implements MouseWheelListener {
     455    private final class MouseScrollListener implements MouseWheelListener {
    456456        @Override
    457457        public void mouseWheelMoved(MouseWheelEvent mwe) {
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r18871 r19050  
    10611061
    10621062        if (ds != null) {
    1063             double dist, snapDistanceSq = PROP_SNAP_DISTANCE.get();
     1063            double dist;
     1064            double snapDistanceSq = PROP_SNAP_DISTANCE.get();
    10641065            snapDistanceSq *= snapDistanceSq;
    10651066
     
    11921193
    11931194        if (preferredRefs != null && preferredRefs.isEmpty()) preferredRefs = null;
    1194         Node ntsel = null, ntnew = null, ntref = null;
     1195        Node ntsel = null;
     1196        Node ntnew = null;
     1197        Node ntref = null;
    11951198        boolean useNtsel = useSelected;
    11961199        double minDistSq = nlists.keySet().iterator().next();
     
    17881791     * so that registered {@link PrimitiveHoverListener}s can be notified.
    17891792     */
    1790     private class PrimitiveHoverMouseListener extends MouseAdapter {
     1793    private final class PrimitiveHoverMouseListener extends MouseAdapter {
    17911794        @Override
    17921795        public void mouseMoved(MouseEvent e) {
  • trunk/src/org/openstreetmap/josm/gui/NotificationManager.java

    r17901 r19050  
    183183    }
    184184
    185     private class PauseFinishedEvent implements ActionListener {
     185    private final class PauseFinishedEvent implements ActionListener {
    186186
    187187        @Override
     
    194194    }
    195195
    196     private class UnfreezeEvent implements ActionListener {
     196    private final class UnfreezeEvent implements ActionListener {
    197197
    198198        @Override
  • trunk/src/org/openstreetmap/josm/gui/SelectionManager.java

    r18456 r19050  
    7979     * @author Michael Zangl
    8080     */
    81     private class SelectionHintLayer extends AbstractMapViewPaintable {
     81    private final class SelectionHintLayer extends AbstractMapViewPaintable {
    8282        @Override
    8383        public void paint(Graphics2D g, MapView mv, Bounds bbox) {
     
    186186        if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1 && MainApplication.getLayerManager().getActiveDataSet() != null) {
    187187            SelectByInternalPointAction.performSelection(MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY()),
    188                     (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) != 0,
     188                    (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0,
    189189                    (e.getModifiersEx() & PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()) != 0);
    190190        } else if (e.getButton() == MouseEvent.BUTTON1) {
     
    201201    @Override
    202202    public void mouseDragged(MouseEvent e) {
    203         int buttonPressed = e.getModifiersEx() & (MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK);
     203        int buttonPressed = e.getModifiersEx() & (InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON3_DOWN_MASK);
    204204
    205205        if (buttonPressed != 0) {
     
    210210        }
    211211
    212         if (buttonPressed == MouseEvent.BUTTON1_DOWN_MASK) {
     212        if (buttonPressed == InputEvent.BUTTON1_DOWN_MASK) {
    213213            mousePos = e.getPoint();
    214214            addLassoPoint(e.getPoint());
    215215            selectionAreaChanged();
    216         } else if (buttonPressed == (MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK)) {
     216        } else if (buttonPressed == (InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON3_DOWN_MASK)) {
    217217            moveSelection(e.getX()-mousePos.x, e.getY()-mousePos.y);
    218218            mousePos = e.getPoint();
     
    253253
    254254        // Left mouse was released while right is still pressed.
    255         boolean rightMouseStillPressed = (e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0;
     255        boolean rightMouseStillPressed = (e.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0;
    256256
    257257        if (!rightMouseStillPressed) {
     
    317317    @Override
    318318    public void propertyChange(PropertyChangeEvent evt) {
    319         if ("active".equals(evt.getPropertyName()) && !(Boolean) evt.getNewValue()) {
     319        if ("active".equals(evt.getPropertyName()) && Boolean.FALSE.equals(evt.getNewValue())) {
    320320            abortSelecting();
    321321        }
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapController.java

    r17334 r19050  
    4545    private static final double ACCELERATION = 0.10;
    4646
    47     private static final int MAC_MOUSE_BUTTON3_MASK = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
     47    private static final int MAC_MOUSE_BUTTON3_MASK = InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK;
    4848
    4949    private static final String[] N = {
     
    7373            for (int i = 0; i < N.length; ++i) {
    7474                contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    75                         KeyStroke.getKeyStroke(K[i], KeyEvent.CTRL_DOWN_MASK), "MapMover.Zoomer." + N[i]);
     75                        KeyStroke.getKeyStroke(K[i], InputEvent.CTRL_DOWN_MASK), "MapMover.Zoomer." + N[i]);
    7676            }
    7777        }
     
    130130    @Override
    131131    public void mouseDragged(MouseEvent e) {
    132         if (iStartSelectionPoint != null && (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK
     132        if (iStartSelectionPoint != null && (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK
    133133                && !(PlatformManager.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) {
    134134            iEndSelectionPoint = e.getPoint();
     
    195195
    196196    /** Moves the map depending on which cursor keys are pressed (or not) */
    197     private class MoveTask extends TimerTask {
     197    private final class MoveTask extends TimerTask {
    198198        /** The current x speed (pixels per timer interval) */
    199199        private double speedX = 1;
     
    212212         * executed via timer) or disabled
    213213         */
    214         protected boolean scheduled;
    215 
    216         protected void setDirectionX(int directionX) {
     214        boolean scheduled;
     215
     216        void setDirectionX(int directionX) {
    217217            this.directionX = directionX;
    218218            updateScheduleStatus();
    219219        }
    220220
    221         protected void setDirectionY(int directionY) {
     221        void setDirectionY(int directionY) {
    222222            this.directionY = directionY;
    223223            updateScheduleStatus();
     
    301301    }
    302302
    303     private class ZoomInAction extends AbstractAction {
     303    private final class ZoomInAction extends AbstractAction {
    304304
    305305        @Override
     
    309309    }
    310310
    311     private class ZoomOutAction extends AbstractAction {
     311    private final class ZoomOutAction extends AbstractAction {
    312312
    313313        @Override
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java

    r12663 r19050  
    111111            renderEmptyRow();
    112112        } else {
    113             switch(column) {
     113            switch (column) {
    114114            case 0:
    115115                renderRowId(getModel(table), row);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java

    r18489 r19050  
    180180     */
    181181    public LatLon getMergedCoords() {
    182         switch(coordMergeDecision) {
     182        switch (coordMergeDecision) {
    183183        case KEEP_MINE: return myCoords;
    184184        case KEEP_THEIR: return theirCoords;
     
    221221     */
    222222    public Boolean getMergedDeletedState() {
    223         switch(deletedMergeDecision) {
     223        switch (deletedMergeDecision) {
    224224        case KEEP_MINE: return myDeletedState;
    225225        case KEEP_THEIR: return theirDeletedState;
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java

    r12663 r19050  
    125125            renderBackground(getModel(table), member, row, column, isSelected);
    126126            renderForeground(getModel(table), member, row, column, isSelected);
    127             switch(column) {
     127            switch (column) {
    128128            case 0:
    129129                renderRowId(row);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeTableCellRenderer.java

    r12661 r19050  
    3535
    3636        TagMergeItem item = (TagMergeItem) value;
    37         switch(col) {
     37        switch (col) {
    3838        case 0:
    3939            renderKey(item, isSelected);
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java

    r18801 r19050  
    150150            editorModel.addElement(MultiValueDecisionType.KEEP_ALL);
    151151        }
    152         switch(decision.getDecisionType()) {
     152        switch (decision.getDecisionType()) {
    153153        case UNDECIDED:
    154154            editor.setSelectedItem(MultiValueDecisionType.UNDECIDED);
     
    220220                setText((String) value);
    221221            } else if (value instanceof MultiValueDecisionType) {
    222                 switch((MultiValueDecisionType) value) {
     222                switch ((MultiValueDecisionType) value) {
    223223                case UNDECIDED:
    224224                    setText(tr("Choose a value"));
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRenderer.java

    r18221 r19050  
    155155        renderColors(decision, isSelected, conflict);
    156156        renderToolTipText(decision);
    157         switch(column) {
     157        switch (column) {
    158158        case 0:
    159159            if (decision.isDecided()) {
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueResolutionDecision.java

    r17333 r19050  
    143143     */
    144144    public String getChosenValue() {
    145         switch(type) {
     145        switch (type) {
    146146        case UNDECIDED: throw new IllegalStateException(tr("Not decided yet"));
    147147        case KEEP_ONE: return value;
     
    294294     */
    295295    public Tag getResolution() {
    296         switch(type) {
     296        switch (type) {
    297297        case SUM_ALL_NUMERIC: return new Tag(getKey(), tags.getSummedValues(getKey()));
    298298        case KEEP_ALL: return new Tag(getKey(), tags.getJoinedValues(getKey()));
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java

    r16438 r19050  
    429429                }
    430430                String msg;
    431                 switch(type) {
     431                switch (type) {
    432432                case NODE: msg = trn("{0} node", "{0} nodes", numPrimitives, numPrimitives); break;
    433433                case WAY: msg = trn("{0} way", "{0} ways", numPrimitives, numPrimitives); break;
     
    461461                StatisticsInfo info = (StatisticsInfo) value;
    462462
    463                 switch(column) {
     463                switch (column) {
    464464                case 0: renderNumTags(info); break;
    465465                case 1: renderFrom(info); break;
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModel.java

    r17220 r19050  
    106106
    107107        RelationMemberConflictDecision d = decisions.get(row);
    108         switch(column) {
     108        switch (column) {
    109109        case 0: /* relation */ return d.getRelation();
    110110        case 1: /* pos */ return Integer.toString(d.getPos() + 1); // position in "user space" starting at 1
    111111        case 2: /* role */ return d.getRole();
    112112        case 3: /* original */ return d.getOriginalPrimitive();
    113         case 4: /* decision keep */ return RelationMemberConflictDecisionType.KEEP.equals(d.getDecision());
    114         case 5: /* decision remove */ return RelationMemberConflictDecisionType.REMOVE.equals(d.getDecision());
     113        case 4: /* decision keep */ return RelationMemberConflictDecisionType.KEEP == d.getDecision();
     114        case 5: /* decision remove */ return RelationMemberConflictDecisionType.REMOVE == d.getDecision();
    115115        }
    116116        return null;
     
    120120    public void setValueAt(Object value, int row, int column) {
    121121        RelationMemberConflictDecision d = decisions.get(row);
    122         switch(column) {
     122        switch (column) {
    123123        case 2: /* role */
    124124            d.setRole((String) value);
     
    200200        decisions.clear();
    201201        this.relations = new HashSet<>(references.size());
    202         final Collection<OsmPrimitive> primitives = new HashSet<>();
     202        final Collection<OsmPrimitive> newPrimitives = new HashSet<>();
    203203        for (RelationToChildReference reference: references) {
    204204            decisions.add(new RelationMemberConflictDecision(reference.getParent(), reference.getPosition()));
    205205            relations.add(reference.getParent());
    206             primitives.add(reference.getChild());
    207         }
    208         this.primitives = primitives;
     206            newPrimitives.add(reference.getChild());
     207        }
     208        this.primitives = newPrimitives;
    209209        refresh();
    210210    }
     
    249249                    final OsmPrimitive primitive = decision.getOriginalPrimitive();
    250250                    if (!decisionsByPrimitive.containsKey(primitive)) {
    251                         decisionsByPrimitive.put(primitive, new ArrayList<RelationMemberConflictDecision>());
     251                        decisionsByPrimitive.put(primitive, new ArrayList<>());
    252252                    }
    253253                    decisionsByPrimitive.get(primitive).add(decision);
     
    263263                        .collect(Collectors.toList());
    264264                while (iterators.stream().allMatch(Iterator::hasNext)) {
    265                     final List<RelationMemberConflictDecision> decisions = new ArrayList<>();
     265                    final List<RelationMemberConflictDecision> conflictDecisions = new ArrayList<>();
    266266                    final Collection<String> roles = new HashSet<>();
    267267                    final Collection<Integer> indices = new TreeSet<>();
    268268                    for (Iterator<RelationMemberConflictDecision> it : iterators) {
    269269                        final RelationMemberConflictDecision decision = it.next();
    270                         decisions.add(decision);
     270                        conflictDecisions.add(decision);
    271271                        roles.add(decision.getRole());
    272272                        indices.add(decision.getPos());
     
    276276                        continue;
    277277                    }
    278                     decisions.get(0).decide(RelationMemberConflictDecisionType.KEEP);
    279                     for (RelationMemberConflictDecision decision : decisions.subList(1, decisions.size())) {
     278                    conflictDecisions.get(0).decide(RelationMemberConflictDecisionType.KEEP);
     279                    for (RelationMemberConflictDecision decision : conflictDecisions.subList(1, conflictDecisions.size())) {
    280280                        decision.decide(RelationMemberConflictDecisionType.REMOVE);
    281281                    }
     
    372372                modifiedMemberList.add(member);
    373373            } else {
    374                 switch(decision.getDecision()) {
     374                switch (decision.getDecision()) {
    375375                case KEEP:
    376376                    final RelationMember newMember = new RelationMember(decision.getRole(), newPrimitive);
     
    410410                continue;
    411411            }
    412             switch(decision.getDecision()) {
     412            switch (decision.getDecision()) {
    413413            case REMOVE: return true;
    414414            case KEEP:
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverModel.java

    r19022 r19050  
    176176        } else if (value instanceof MultiValueDecisionType) {
    177177            MultiValueDecisionType type = (MultiValueDecisionType) value;
    178             switch(type) {
     178            switch (type) {
    179179            case KEEP_NONE:
    180180                decision.keepNone();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java

    r18801 r19050  
    66import java.awt.Component;
    77import java.awt.Dimension;
     8import java.awt.GridBagConstraints;
    89import java.awt.GridBagLayout;
    910import java.awt.event.ActionEvent;
     
    120121        treesPanel.add(spacer, GBC.eol());
    121122        spacer.setVisible(false);
    122         treesPanel.add(undoTree, GBC.eol().fill(GBC.HORIZONTAL));
     123        treesPanel.add(undoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    123124        separator.setVisible(false);
    124         treesPanel.add(separator, GBC.eol().fill(GBC.HORIZONTAL));
    125         treesPanel.add(redoTree, GBC.eol().fill(GBC.HORIZONTAL));
     125        treesPanel.add(separator, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     126        treesPanel.add(redoTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    126127        treesPanel.add(Box.createRigidArea(new Dimension(0, 0)), GBC.std().weight(0, 1));
    127128        treesPanel.setBackground(redoTree.getBackground());
     
    146147    }
    147148
    148     private static class CommandCellRenderer extends DefaultTreeCellRenderer {
     149    private static final class CommandCellRenderer extends DefaultTreeCellRenderer {
    149150        @Override
    150151        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row,
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java

    r14153 r19050  
    1616import javax.swing.JOptionPane;
    1717import javax.swing.JPanel;
     18import javax.swing.SwingConstants;
    1819
    1920import org.openstreetmap.josm.data.UndoRedoHandler;
     
    3435    /** the conflict resolver component */
    3536    private final ConflictResolver resolver = new ConflictResolver();
    36     private final JLabel titleLabel = new JLabel("", null, JLabel.CENTER);
     37    private final JLabel titleLabel = new JLabel("", null, SwingConstants.CENTER);
    3738
    3839    private final ApplyResolutionAction applyResolutionAction = new ApplyResolutionAction();
     
    196197                        options[1]
    197198                );
    198                 switch(ret) {
     199                switch (ret) {
    199200                case JOptionPane.YES_OPTION:
    200201                    buttonAction(1, evt);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java

    r18395 r19050  
    215215     */
    216216    public static class RelationMemberTableModel extends DefaultTableModel {
    217         private static class RelationToChildReferenceComparator implements Comparator<RelationToChildReference>, Serializable {
     217        private static final class RelationToChildReferenceComparator implements Comparator<RelationToChildReference>, Serializable {
    218218            private static final long serialVersionUID = 1L;
    219219            @Override
     
    292292            if (data == null) return null;
    293293            RelationToChildReference ref = data.get(rowIndex);
    294             switch(columnIndex) {
     294            switch (columnIndex) {
    295295            case 0: return ref.getChild();
    296296            case 1: return ref.getParent();
     
    423423            }
    424424            Pair<Relation, Boolean> ref = this.data.get(rowIndex);
    425             switch(columnIndex) {
     425            switch (columnIndex) {
    426426            case 0: return ref.a;
    427427            case 1: return ref.b;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r17773 r19050  
    695695    }
    696696
    697     private class LayerNameCellRenderer extends DefaultTableCellRenderer {
    698 
    699         protected boolean isActiveLayer(Layer layer) {
     697    private final class LayerNameCellRenderer extends DefaultTableCellRenderer {
     698
     699        boolean isActiveLayer(Layer layer) {
    700700            return getLayerManager().getActiveLayer() == layer;
    701701        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r18715 r19050  
    88import java.awt.Dimension;
    99import java.awt.Font;
     10import java.awt.GridBagConstraints;
    1011import java.awt.GridBagLayout;
    1112import java.awt.Insets;
     
    122123
    123124        cbWireframe = new JCheckBox();
    124         JLabel wfLabel = new JLabel(tr("Wireframe View"), ImageProvider.get("dialogs/mappaint", "wireframe_small"), JLabel.HORIZONTAL);
     125        JLabel wfLabel = new JLabel(tr("Wireframe View"), ImageProvider.get("dialogs/mappaint", "wireframe_small"), SwingConstants.HORIZONTAL);
    125126        wfLabel.setFont(wfLabel.getFont().deriveFont(Font.PLAIN));
    126127        wfLabel.setLabelFor(cbWireframe);
     
    296297    }
    297298
    298     private class StyleSourceRenderer extends DefaultTableCellRenderer {
     299    private final class StyleSourceRenderer extends DefaultTableCellRenderer {
    299300        @Override
    300301        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
     
    575576                tabs.setEnabledAt(pos, false);
    576577            } else {
    577                 JLabel lblErrors = new JLabel(tr(title), icon, JLabel.HORIZONTAL);
     578                JLabel lblErrors = new JLabel(tr(title), icon, SwingConstants.HORIZONTAL);
    578579                lblErrors.setLabelFor(pErrors);
    579580                tabs.setTabComponentAt(pos, lblErrors);
     
    601602            text.append(tableRow(tr("Style is currently active?"), s.active ? tr("Yes") : tr("No")))
    602603                .append("</table>");
    603             p.add(new JScrollPane(new HtmlPanel(text.toString())), GBC.eol().fill(GBC.BOTH));
     604            p.add(new JScrollPane(new HtmlPanel(text.toString())), GBC.eol().fill(GridBagConstraints.BOTH));
    604605            return p;
    605606        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MenuItemSearchDialog.java

    r17188 r19050  
    9393    }
    9494
    95     private static class CellRenderer implements ListCellRenderer<JMenuItem> {
     95    private static final class CellRenderer implements ListCellRenderer<JMenuItem> {
    9696
    9797        @Override
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r18815 r19050  
    498498            int numRelations = 0;
    499499            for (OsmPrimitive p: selection) {
    500                 switch(p.getType()) {
     500                switch (p.getType()) {
    501501                case NODE: numNodes++; break;
    502502                case WAY: numWays++; break;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r18715 r19050  
    351351        public Object getValueAt(int row, int column) {
    352352            UserInfo info = data.get(row);
    353             switch(column) {
     353            switch (column) {
    354354            case 0: /* author */ return info.getName() == null ? "" : info.getName();
    355355            case 1: /* count */ return info.count;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java

    r17717 r19050  
    5757        renderColors(isSelected);
    5858        Changeset cs = (Changeset) value;
    59         switch(column) {
     59        switch (column) {
    6060        case 0: /* id */ renderId(cs.getId()); break;
    6161        case 1: /* upload comment */ renderUploadComment(cs); break;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableCellRenderer.java

    r13564 r19050  
    2222     */
    2323    protected void renderModificationType(ChangesetModificationType type) {
    24         switch(type) {
     24        switch (type) {
    2525        case CREATED: setText(tr("Created")); break;
    2626        case UPDATED: setText(tr("Updated")); break;
     
    3737        reset();
    3838        renderColors(isSelected);
    39         switch(column) {
     39        switch (column) {
    4040        case 0:
    4141            if (value instanceof ChangesetModificationType) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableModel.java

    r16953 r19050  
    114114    @Override
    115115    public Object getValueAt(int row, int col) {
    116         switch(col) {
     116        switch (col) {
    117117        case 0: return data.get(row).getModificationType();
    118118        default: return data.get(row).getPrimitive();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDiscussionTableCellRenderer.java

    r17717 r19050  
    2525        reset(comp, true);
    2626        renderColors(comp, isSelected);
    27         switch(column) {
     27        switch (column) {
    2828        case 0:
    2929            renderInstant((Instant) value);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java

    r16436 r19050  
    165165        } else {
    166166            try {
    167                 q = BasicQuery.valueOf(BasicQuery.class, value);
     167                q = BasicQuery.valueOf(value);
    168168            } catch (IllegalArgumentException e) {
    169169                Logging.log(Logging.LEVEL_WARN, tr("Unexpected value for preference ''{0}'', got ''{1}''. Resetting to default query.",
     
    194194        if (q == null)
    195195            return query;
    196         switch(q) {
     196        switch (q) {
    197197        case MOST_RECENT_CHANGESETS:
    198198            break;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialog.java

    r16075 r19050  
    126126        if (isCanceled())
    127127            return null;
    128         switch(tpQueryPanels.getSelectedIndex()) {
     128        switch (tpQueryPanels.getSelectedIndex()) {
    129129        case 0:
    130130            return pnlBasicChangesetQueries.buildChangesetQuery();
     
    186186        public void actionPerformed(ActionEvent arg0) {
    187187            try {
    188                 switch(tpQueryPanels.getSelectedIndex()) {
     188                switch (tpQueryPanels.getSelectedIndex()) {
    189189                case 0:
    190190                    // currently, query specifications can't be invalid in the basic query panel.
  • trunk/src/org/openstreetmap/josm/gui/dialogs/layer/MergeGpxLayerDialog.java

    r16630 r19050  
    55
    66import java.awt.Component;
     7import java.awt.GridBagConstraints;
    78import java.awt.GridBagLayout;
    89import java.awt.event.ActionEvent;
     
    5859        p.add(new JLabel("<html>" +
    5960                tr("Please select the order of the selected layers:<br>Tracks will be cut, when timestamps of higher layers are overlapping.") +
    60                 "</html>"), GBC.std(0, 0).fill(GBC.HORIZONTAL).span(2));
     61                "</html>"), GBC.std(0, 0).fill(GridBagConstraints.HORIZONTAL).span(2));
    6162
    6263        c = new JCheckBox(tr("Connect overlapping tracks on cuts"));
    6364        c.setSelected(Config.getPref().getBoolean("mergelayer.gpx.connect", true));
    64         p.add(c, GBC.std(0, 1).fill(GBC.HORIZONTAL).span(2));
     65        p.add(c, GBC.std(0, 1).fill(GridBagConstraints.HORIZONTAL).span(2));
    6566
    6667        model = new GpxLayersTableModel(layers);
     
    8586        btnDown.setIcon(ImageProvider.get("dialogs", "down", ImageSizes.SMALLICON));
    8687
    87         p.add(btnUp, GBC.std(0, 3).fill(GBC.HORIZONTAL));
    88         p.add(btnDown, GBC.std(1, 3).fill(GBC.HORIZONTAL));
     88        p.add(btnUp, GBC.std(0, 3).fill(GridBagConstraints.HORIZONTAL));
     89        p.add(btnDown, GBC.std(1, 3).fill(GridBagConstraints.HORIZONTAL));
    8990
    9091        btnUp.addActionListener(new MoveLayersActionListener(true));
     
    152153    }
    153154
    154     private class RowSelectionChangedListener implements ListSelectionListener {
     155    private final class RowSelectionChangedListener implements ListSelectionListener {
    155156
    156157        @Override
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r18801 r19050  
    88import java.awt.Container;
    99import java.awt.Font;
     10import java.awt.GridBagConstraints;
    1011import java.awt.GridBagLayout;
    1112import java.awt.Point;
     
    101102import org.openstreetmap.josm.gui.dialogs.relation.RelationPopupMenus;
    102103import org.openstreetmap.josm.gui.help.HelpUtil;
     104import org.openstreetmap.josm.gui.layer.Layer;
    103105import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
    104106import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    105 import org.openstreetmap.josm.gui.layer.Layer;
    106107import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    107108import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
     
    293294        boolean presetsVisible = Config.getPref().getBoolean("properties.presets.visible", true);
    294295        if (presetsVisible && top) {
    295             bothTables.add(presets, GBC.std().fill(GBC.HORIZONTAL).insets(5, 2, 5, 2).anchor(GBC.NORTHWEST));
     296            bothTables.add(presets, GBC.std().fill(GridBagConstraints.HORIZONTAL).insets(5, 2, 5, 2).anchor(GridBagConstraints.NORTHWEST));
    296297            double epsilon = Double.MIN_VALUE; // need to set a weight or else anchor value is ignored
    297             bothTables.add(pluginHook, GBC.eol().insets(0, 1, 1, 1).anchor(GBC.NORTHEAST).weight(epsilon, epsilon));
     298            bothTables.add(pluginHook, GBC.eol().insets(0, 1, 1, 1).anchor(GridBagConstraints.NORTHEAST).weight(epsilon, epsilon));
    298299        }
    299300        bothTables.add(selectSth, GBC.eol().fill().insets(10, 10, 10, 10));
    300         bothTables.add(tagTableFilter, GBC.eol().fill(GBC.HORIZONTAL));
    301         bothTables.add(tagTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL));
    302         bothTables.add(tagTable, GBC.eol().fill(GBC.BOTH));
    303         bothTables.add(membershipTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL));
    304         bothTables.add(membershipTable, GBC.eol().fill(GBC.BOTH));
     301        bothTables.add(tagTableFilter, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     302        bothTables.add(tagTable.getTableHeader(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     303        bothTables.add(tagTable, GBC.eol().fill(GridBagConstraints.BOTH));
     304        bothTables.add(membershipTable.getTableHeader(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     305        bothTables.add(membershipTable, GBC.eol().fill(GridBagConstraints.BOTH));
    305306        if (presetsVisible && !top) {
    306             bothTables.add(presets, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 2, 5, 2));
     307            bothTables.add(presets, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(5, 2, 5, 2));
    307308        }
    308309
     
    15041505     * Clears the row selection when it is filtered away by the row sorter.
    15051506     */
    1506     private class RemoveHiddenSelection implements ListSelectionListener, RowSorterListener {
     1507    private final class RemoveHiddenSelection implements ListSelectionListener, RowSorterListener {
    15071508
    15081509        void removeHiddenSelection() {
     
    15271528    }
    15281529
    1529     private class HoverPreviewPropListener implements ValueChangeListener<Boolean> {
     1530    private final class HoverPreviewPropListener implements ValueChangeListener<Boolean> {
    15301531        @Override
    15311532        public void valueChanged(ValueChangeEvent<? extends Boolean> e) {
     
    15421543     * Otherwise user would need to change selection to see the preference change take effect.
    15431544     */
    1544     private class HoverPreviewPreferSelectionPropListener implements ValueChangeListener<Boolean> {
     1545    private final class HoverPreviewPreferSelectionPropListener implements ValueChangeListener<Boolean> {
    15451546        @Override
    15461547        public void valueChanged(ValueChangeEvent<? extends Boolean> e) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r19014 r19050  
    3333
    3434import javax.swing.AbstractAction;
     35import javax.swing.Action;
    3536import javax.swing.BorderFactory;
    3637import javax.swing.InputMap;
     
    4849import javax.swing.JToolBar;
    4950import javax.swing.KeyStroke;
     51import javax.swing.SwingConstants;
    5052import javax.swing.event.TableModelListener;
    5153
     
    670672         */
    671673        LeftButtonToolbar(IRelationEditorActionAccess editorAccess) {
    672             setOrientation(JToolBar.VERTICAL);
     674            setOrientation(SwingConstants.VERTICAL);
    673675            setFloatable(false);
    674676
     
    703705
    704706
    705             InputMap inputMap = editorAccess.getMemberTable().getInputMap(MemberTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
     707            InputMap inputMap = editorAccess.getMemberTable().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    706708            inputMap.put((KeyStroke) new RemoveAction(editorAccess, "removeSelected")
    707                     .getValue(AbstractAction.ACCELERATOR_KEY), "removeSelected");
     709                    .getValue(Action.ACCELERATOR_KEY), "removeSelected");
    708710            inputMap.put((KeyStroke) new MoveUpAction(editorAccess, "moveUp")
    709                     .getValue(AbstractAction.ACCELERATOR_KEY), "moveUp");
     711                    .getValue(Action.ACCELERATOR_KEY), "moveUp");
    710712            inputMap.put((KeyStroke) new MoveDownAction(editorAccess, "moveDown")
    711                     .getValue(AbstractAction.ACCELERATOR_KEY), "moveDown");
     713                    .getValue(Action.ACCELERATOR_KEY), "moveDown");
    712714            inputMap.put((KeyStroke) new DownloadIncompleteMembersAction(
    713                     editorAccess, "downloadIncomplete").getValue(AbstractAction.ACCELERATOR_KEY), "downloadIncomplete");
     715                    editorAccess, "downloadIncomplete").getValue(Action.ACCELERATOR_KEY), "downloadIncomplete");
    714716        }
    715717    }
     
    722724     */
    723725    protected static JToolBar buildSelectionControlButtonToolbar(IRelationEditorActionAccess editorAccess) {
    724         JToolBar tb = new JToolBar(JToolBar.VERTICAL);
     726        JToolBar tb = new JToolBar(SwingConstants.VERTICAL);
    725727        tb.setFloatable(false);
    726728
     
    849851                            tr("Remove them, clean up relation")
    850852            );
    851             switch(ret) {
     853            switch (ret) {
    852854            case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION:
    853855            case JOptionPane.CLOSED_OPTION:
     
    928930                null
    929931        );
    930         switch(ret) {
     932        switch (ret) {
    931933        case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION:
    932934        case JOptionPane.YES_OPTION:
     
    10361038    }
    10371039
    1038     private class RelationEditorActionAccess implements IRelationEditorActionAccess {
     1040    private final class RelationEditorActionAccess implements IRelationEditorActionAccess {
    10391041
    10401042        @Override
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SetRoleAction.java

    r18208 r19050  
    7070                options[0]
    7171        );
    72         switch(ret) {
     72        switch (ret) {
    7373        case JOptionPane.YES_OPTION:
    7474        case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION:
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorter.java

    r19048 r19050  
    173173        // Dispatch members to the first adequate sorter
    174174        for (RelationMember m : relationMembers) {
    175             var wasAdded = false;
     175            boolean wasAdded = false;
    176176            for (AdditionalSorter sorter : ADDITIONAL_SORTERS) {
    177177                if (sorter.acceptsMember(relationMembers, m)) {
  • trunk/src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java

    r18728 r19050  
    99import java.awt.FlowLayout;
    1010import java.awt.Font;
     11import java.awt.GridBagConstraints;
    1112import java.awt.GridBagLayout;
    1213import java.lang.reflect.InvocationTargetException;
     
    218219
    219220            downloadSourcesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    220             add(downloadSourcesPanel, GBC.eol().fill(GBC.HORIZONTAL));
     221            add(downloadSourcesPanel, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    221222            updateSources();
    222223
     
    224225            JPanel sizeCheckPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    225226            sizeCheckPanel.add(sizeCheck);
    226             add(sizeCheckPanel, GBC.eol().fill(GBC.HORIZONTAL));
     227            add(sizeCheckPanel, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    227228
    228229            setMinimumSize(new Dimension(450, 115));
     
    354355    }
    355356
    356     private static class OsmDataDownloadType implements IDownloadSourceType {
     357    private static final class OsmDataDownloadType implements IDownloadSourceType {
    357358        static final BooleanProperty IS_ENABLED = new BooleanProperty("download.osm.data", true);
    358359        JCheckBox cbDownloadOsmData;
     
    394395    }
    395396
    396     private static class GpsDataDownloadType implements IDownloadSourceType {
     397    private static final class GpsDataDownloadType implements IDownloadSourceType {
    397398        static final BooleanProperty IS_ENABLED = new BooleanProperty("download.osm.gps", false);
    398399        private JCheckBox cbDownloadGpxData;
     
    432433    }
    433434
    434     private static class NotesDataDownloadType implements IDownloadSourceType {
     435    private static final class NotesDataDownloadType implements IDownloadSourceType {
    435436        static final BooleanProperty IS_ENABLED = new BooleanProperty("download.osm.notes", false);
    436437        private JCheckBox cbDownloadNotes;
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r18805 r19050  
    77import java.awt.Component;
    88import java.awt.Dimension;
     9import java.awt.GridBagConstraints;
    910import java.awt.GridBagLayout;
    1011import java.awt.event.ActionEvent;
     
    106107
    107108        lpanel.add(new JLabel(tr("Choose the server for searching:")), GBC.std(0, 0).weight(0, 0).insets(0, 0, 5, 0));
    108         lpanel.add(serverComboBox, GBC.std(1, 0).fill(GBC.HORIZONTAL));
     109        lpanel.add(serverComboBox, GBC.std(1, 0).fill(GridBagConstraints.HORIZONTAL));
    109110        String s = Config.getPref().get("namefinder.server", SERVERS[0].name);
    110111        for (int i = 0; i < SERVERS.length; ++i) {
     
    118119        cbSearchExpression.setToolTipText(tr("Enter a place name to search for"));
    119120        cbSearchExpression.getModel().prefs().load(HISTORY_KEY);
    120         lpanel.add(cbSearchExpression, GBC.std(1, 1).fill(GBC.HORIZONTAL));
    121 
    122         panel.add(lpanel, GBC.std().fill(GBC.HORIZONTAL).insets(5, 5, 0, 5));
     121        lpanel.add(cbSearchExpression, GBC.std(1, 1).fill(GridBagConstraints.HORIZONTAL));
     122
     123        panel.add(lpanel, GBC.std().fill(GridBagConstraints.HORIZONTAL).insets(5, 5, 0, 5));
    123124        SearchAction searchAction = new SearchAction();
    124125        JButton btnSearch = new JButton(searchAction);
     
    495496                return this;
    496497            SearchResult sr = (SearchResult) value;
    497             switch(column) {
     498            switch (column) {
    498499            case 0:
    499500                setText(sr.getName());
  • trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java

    r17733 r19050  
    5757        RelationMemberData member = (RelationMemberData) diffItem.value;
    5858        if (member != null) {
    59             switch(member.getMemberType()) {
     59            switch (member.getMemberType()) {
    6060            case NODE: text = tr("Node {0}", member.getMemberId()); break;
    6161            case WAY: text = tr("Way {0}", member.getMemberId()); break;
     
    7878        Item member = (TwoColumnDiff.Item) value;
    7979        Item.DiffItemType type = member.state;
    80         switch(column) {
     80        switch (column) {
    8181        case RelationMemberTableColumnModel.INDEX_COLUMN:
    8282            type = Item.DiffItemType.EMPTY;
  • trunk/src/org/openstreetmap/josm/gui/history/TagTableCellRenderer.java

    r17904 r19050  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.history;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import java.awt.Color;
     
    1315import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive;
    1416import org.openstreetmap.josm.gui.util.GuiHelper;
    15 
    16 import static org.openstreetmap.josm.tools.I18n.tr;
    1717
    1818/**
     
    5151        setBorder(null);
    5252        if (model.hasTag(key)) {
    53             switch(column) {
     53            switch (column) {
    5454            case TagTableColumnModel.COLUMN_KEY:
    5555                // the name column
  • trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java

    r17841 r19050  
    4141/**
    4242 * Abstract base class for the task of uploading primitives via OSM API.
    43  *
     43 * <p>
    4444 * Mainly handles conflicts and certain error situations.
    4545 */
     
    9898    /**
    9999     * Synchronizes the local state of the dataset with the state on the server.
    100      *
     100     * <p>
    101101     * Reuses the functionality of {@link UpdateDataAction}.
    102102     *
     
    121121            String myVersion) {
    122122        String lbl;
    123         switch(primitiveType) {
     123        switch (primitiveType) {
    124124        // CHECKSTYLE.OFF: SingleSpaceSeparator
    125125        case NODE:     lbl = tr("Synchronize node {0} only", id); break;
     
    164164                "/Concepts/Conflict"
    165165        );
    166         switch(ret) {
     166        switch (ret) {
    167167        case 0: synchronizePrimitive(primitiveType, id); break;
    168168        case 1: synchronizeDataSet(); break;
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java

    r18801 r19050  
    195195            if (e.getItemSelectable() != cbCloseAfterUpload)
    196196                return;
    197             switch(e.getStateChange()) {
     197            switch (e.getStateChange()) {
    198198            case ItemEvent.SELECTED:
    199199                firePropertyChange(CLOSE_CHANGESET_AFTER_UPLOAD, false, true);
  • trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java

    r14214 r19050  
    4949/**
    5050 * Dialog box to request username and password from the user.
    51  *
     51 * <p>
    5252 * The credentials can be for the OSM API (basic authentication), a different
    5353 * host or an HTTP proxy.
     
    370370    }
    371371
    372     private static class SelectAllOnFocusHandler extends FocusAdapter {
     372    private static final class SelectAllOnFocusHandler extends FocusAdapter {
    373373        @Override
    374374        public void focusGained(FocusEvent e) {
  • trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java

    r18972 r19050  
    467467                Element elem = (Element) item;
    468468
    469                 switch(elementName) {
     469                switch (elementName) {
    470470                case "var":
    471471                    setVar(elem.getAttribute("name"), evalVars(elem.getAttribute("value")));
  • trunk/src/org/openstreetmap/josm/gui/io/OnlineResourceMenu.java

    r17041 r19050  
    7777    }
    7878
    79     private class ToggleMenuListener implements MenuListener {
     79    private final class ToggleMenuListener implements MenuListener {
    8080        @Override
    8181        public void menuSelected(MenuEvent e) {
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r18996 r19050  
    3737import javax.swing.JScrollPane;
    3838import javax.swing.ListCellRenderer;
     39import javax.swing.SwingConstants;
    3940import javax.swing.WindowConstants;
    4041import javax.swing.event.TableModelEvent;
     
    132133                dialog.getModel().populate(layersWithUnsavedChanges);
    133134                dialog.setVisible(true);
    134                 switch(dialog.getUserAction()) {
     135                switch (dialog.getUserAction()) {
    135136                    case PROCEED: return true;
    136137                    case CANCEL:
     
    182183
    183184        model.addPropertyChangeListener(saveAndProceedAction);
    184         pnl.add(saveAndProceedActionButton, GBC.std(0, 0).insets(5, 5, 0, 0).fill(GBC.HORIZONTAL));
    185 
    186         pnl.add(new JButton(saveSessionAction), GBC.std(1, 0).insets(5, 5, 5, 0).fill(GBC.HORIZONTAL));
     185        pnl.add(saveAndProceedActionButton, GBC.std(0, 0).insets(5, 5, 0, 0).fill(GridBagConstraints.HORIZONTAL));
     186
     187        pnl.add(new JButton(saveSessionAction), GBC.std(1, 0).insets(5, 5, 5, 0).fill(GridBagConstraints.HORIZONTAL));
    187188
    188189        model.addPropertyChangeListener(discardAndProceedAction);
    189         pnl.add(new JButton(discardAndProceedAction), GBC.std(0, 1).insets(5, 5, 0, 5).fill(GBC.HORIZONTAL));
    190 
    191         pnl.add(new JButton(cancelAction), GBC.std(1, 1).insets(5, 5, 5, 5).fill(GBC.HORIZONTAL));
     190        pnl.add(new JButton(discardAndProceedAction), GBC.std(0, 1).insets(5, 5, 0, 5).fill(GridBagConstraints.HORIZONTAL));
     191
     192        pnl.add(new JButton(cancelAction), GBC.std(1, 1).insets(5, 5, 5, 5).fill(GridBagConstraints.HORIZONTAL));
    192193
    193194        JPanel pnl2 = new JPanel(new BorderLayout());
     
    267268            gc.weighty = 0.0;
    268269            add(lblMessage, gc);
    269             lblMessage.setHorizontalAlignment(JLabel.LEADING);
     270            lblMessage.setHorizontalAlignment(SwingConstants.LEADING);
    270271            lstLayers.setCellRenderer(new LayerCellRenderer());
    271272            gc.gridx = 0;
     
    377378
    378379        public void cancel() {
    379             switch(model.getMode()) {
     380            switch (model.getMode()) {
    380381            case EDITING_DATA: cancelWhenInEditingModel();
    381382                break;
     
    426427            if (evt.getPropertyName().equals(SaveLayersModel.MODE_PROP)) {
    427428                Mode mode = (Mode) evt.getNewValue();
    428                 switch(mode) {
     429                switch (mode) {
    429430                case EDITING_DATA: setEnabled(true);
    430431                    break;
     
    523524            if (evt.getPropertyName().equals(SaveLayersModel.MODE_PROP)) {
    524525                SaveLayersModel.Mode mode = (SaveLayersModel.Mode) evt.getNewValue();
    525                 switch(mode) {
     526                switch (mode) {
    526527                case EDITING_DATA: setEnabled(true);
    527528                    break;
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersModel.java

    r18972 r19050  
    103103    public void setValueAt(Object value, int row, int column) {
    104104        final SaveLayerInfo info = this.layerInfo.get(row);
    105         switch(column) {
     105        switch (column) {
    106106        case columnFilename:
    107107            info.setFile((File) value);
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersTable.java

    r12452 r19050  
    2626        if (evt.getPropertyName().equals(SaveLayersModel.MODE_PROP)) {
    2727            Mode mode = (Mode) evt.getNewValue();
    28             switch(mode) {
     28            switch (mode) {
    2929            case EDITING_DATA: setEnabled(true);
    3030            break;
  • trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java

    r19048 r19050  
    170170        switch (strategy.getPolicy()) {
    171171        case AUTOMATICALLY_OPEN_NEW_CHANGESETS:
    172             final var newChangeSet = new Changeset();
     172            final Changeset newChangeSet = new Changeset();
    173173            newChangeSet.setKeys(changeset.getKeys());
    174174            closeChangeset();
     
    372372            if (uploadCanceled) return;
    373373            if (lastException == null) {
    374                 final var panel = new HtmlPanel(
     374                final HtmlPanel panel = new HtmlPanel(
    375375                        "<h3><a href=\"" + Config.getUrls().getBaseBrowseUrl() + "/changeset/" + changeset.getId() + "\">"
    376376                                + tr("Upload successful!") + "</a></h3>");
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java

    r18283 r19050  
    212212        UploadStrategySpecification spec = new UploadStrategySpecification();
    213213        if (strategy != null) {
    214             switch(strategy) {
     214            switch (strategy) {
    215215            case CHUNKED_DATASET_STRATEGY:
    216216                spec.setStrategy(strategy).setChunkSize(getChunkSize());
     
    389389            if (strategy == null)
    390390                return;
    391             switch(strategy) {
     391            switch (strategy) {
    392392            case CHUNKED_DATASET_STRATEGY:
    393393                tfChunkSize.setEnabled(true);
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r18926 r19050  
    14811481     * Data container to hold information about a {@code TileSet} class.
    14821482     */
    1483     private static class TileSetInfo {
     1483    private static final class TileSetInfo {
    14841484        boolean hasVisibleTiles;
    14851485        boolean hasOverzoomedTiles;
     
    20262026    }
    20272027
    2028     private class TileSourcePainter extends CompatibilityModeLayerPainter {
     2028    private final class TileSourcePainter extends CompatibilityModeLayerPainter {
    20292029        /** The memory handle that will hold our tile source. */
    20302030        private MemoryHandle<?> memory;
     
    20722072        }
    20732073
    2074         protected long getEstimatedCacheSize() {
     2074        private long getEstimatedCacheSize() {
    20752075            return 4L * tileSource.getTileSize() * tileSource.getTileSize() * estimateTileCacheSize();
    20762076        }
  • trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java

    r18972 r19050  
    161161     */
    162162    public static ImageryLayer create(ImageryInfo info) {
    163         switch(info.getImageryType()) {
     163        switch (info.getImageryType()) {
    164164        case WMS:
    165165        case WMS_ENDPOINT:
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r19048 r19050  
    6767import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
    6868import org.openstreetmap.josm.gui.layer.geoimage.AdjustTimezoneAndOffsetDialog.AdjustListener;
     69import org.openstreetmap.josm.gui.layer.geoimage.SynchronizeTimeFromPhotoDialog.TimeZoneItem;
    6970import org.openstreetmap.josm.gui.layer.gpx.GpxDataHelper;
    7071import org.openstreetmap.josm.gui.widgets.JosmComboBox;
     
    172173                // Search whether an other layer has yet defined some bounding box.
    173174                // If none, we'll zoom to the bounding box of the layer with the photos.
    174                 var boundingBoxedLayerFound = false;
     175                boolean boundingBoxedLayerFound = false;
    175176                for (Layer l: MainApplication.getLayerManager().getLayers()) {
    176177                    if (l != yLayer) {
    177                         final var bbox = new BoundingXYVisitor();
     178                        BoundingXYVisitor bbox = new BoundingXYVisitor();
    178179                        l.visitBoundingBox(bbox);
    179180                        if (bbox.getBounds() != null) {
     
    184185                }
    185186                if (!boundingBoxedLayerFound) {
    186                     final var bbox = new BoundingXYVisitor();
     187                    BoundingXYVisitor bbox = new BoundingXYVisitor();
    187188                    yLayer.visitBoundingBox(bbox);
    188189                    MainApplication.getMap().mapView.zoomTo(bbox);
     
    264265        @Override
    265266        public void actionPerformed(ActionEvent e) {
    266             final var sel = GpxDataHelper.chooseGpxDataFile();
     267            File sel = GpxDataHelper.chooseGpxDataFile();
    267268            if (sel != null) {
    268269                try {
    269270                    outerPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    270271                    removeDuplicates(sel);
    271                     final var data = GpxDataHelper.loadGpxData(sel);
     272                    GpxData data = GpxDataHelper.loadGpxData(sel);
    272273                    if (data != null) {
    273                         final var elem = new GpxDataWrapper(sel.getName(), data, sel);
     274                        GpxDataWrapper elem = new GpxDataWrapper(sel.getName(), data, sel);
    274275                        gpxModel.addElement(elem);
    275276                        gpxModel.setSelectedItem(elem);
     
    299300        @Override
    300301        public void actionPerformed(ActionEvent e) {
    301             final var ed = new AdvancedCorrelationSettingsDialog(MainApplication.getMainFrame(), forceTags);
     302            AdvancedCorrelationSettingsDialog ed = new AdvancedCorrelationSettingsDialog(MainApplication.getMainFrame(), forceTags);
    302303            if (ed.showDialog().getValue() == 1) {
    303304                forceTags = ed.isForceTaggingSelected(); // This setting is not supposed to be saved permanently
     
    320321        @Override
    321322        public void actionPerformed(ActionEvent e) {
    322             var isOk = false;
     323            boolean isOk = false;
    323324            while (!isOk) {
    324                 final var ed = new SynchronizeTimeFromPhotoDialog(MainApplication.getMainFrame(), yLayer.getImageData().getImages());
     325                SynchronizeTimeFromPhotoDialog ed = new SynchronizeTimeFromPhotoDialog(
     326                        MainApplication.getMainFrame(), yLayer.getImageData().getImages());
    325327                int answer = ed.showDialog().getValue();
    326328                if (answer != 1)
     
    338340                }
    339341
    340                 final var selectedTz = ed.getTimeZoneItem();
     342                TimeZoneItem selectedTz = ed.getTimeZoneItem();
    341343
    342344                Config.getPref().put("geoimage.timezoneid", selectedTz.getID());
     
    355357        @Override
    356358        public void layerAdded(LayerAddEvent e) {
    357             final var layer = e.getAddedLayer();
     359            Layer layer = e.getAddedLayer();
    358360            if (layer instanceof GpxDataContainer) {
    359                 final var gpx = ((GpxDataContainer) layer).getGpxData();
    360                 final var file = gpx.storageFile;
     361                GpxData gpx = ((GpxDataContainer) layer).getGpxData();
     362                File file = gpx.storageFile;
    361363                removeDuplicates(file);
    362                 final var gdw = new GpxDataWrapper(layer.getName(), gpx, file);
     364                GpxDataWrapper gdw = new GpxDataWrapper(layer.getName(), gpx, file);
    363365                layer.addPropertyChangeListener(new GpxLayerRenamedListener(gdw));
    364366                gpxModel.addElement(gdw);
     
    374376        @Override
    375377        public void layerRemoving(LayerRemoveEvent e) {
    376             final var layer = e.getRemovedLayer();
     378            Layer layer = e.getRemovedLayer();
    377379            if (layer instanceof GpxDataContainer) {
    378                 final var removedGpxData = ((GpxDataContainer) layer).getGpxData();
     380                GpxData removedGpxData = ((GpxDataContainer) layer).getGpxData();
    379381                for (int i = gpxModel.getSize() - 1; i >= 0; i--) {
    380382                    GpxData data = gpxModel.getElementAt(i).data;
     
    426428        for (AbstractModifiableLayer cur : MainApplication.getLayerManager().getLayersOfType(AbstractModifiableLayer.class)) {
    427429            if (cur instanceof GpxDataContainer) {
    428                 final var data = ((GpxDataContainer) cur).getGpxData();
    429                 final var gdw = new GpxDataWrapper(cur.getName(), data, data.storageFile);
     430                GpxData data = ((GpxDataContainer) cur).getGpxData();
     431                GpxDataWrapper gdw = new GpxDataWrapper(cur.getName(), data, data.storageFile);
    430432                cur.addPropertyChangeListener(new GpxLayerRenamedListener(gdw));
    431433                gpxModel.addElement(gdw);
     
    469471    @Override
    470472    public void actionPerformed(ActionEvent ae) {
    471         final var nogdw = new NoGpxDataWrapper();
     473        NoGpxDataWrapper nogdw = new NoGpxDataWrapper();
    472474        if (gpxModel == null) {
    473475            constructGpxModel(nogdw);
    474476        }
    475477
    476         final var panelCb = new JPanel();
     478        JPanel panelCb = new JPanel();
    477479
    478480        panelCb.add(new JLabel(tr("GPX track: ")));
     
    483485        panelCb.add(cbGpx);
    484486
    485         final var buttonOpen = new JButton(tr("Open another GPX trace"));
     487        JButton buttonOpen = new JButton(tr("Open another GPX trace"));
    486488        buttonOpen.addActionListener(new LoadGpxDataActionListener());
    487489        panelCb.add(buttonOpen);
     
    491493        panelCb.add(buttonSupport);
    492494
    493         final var panelTf = new JPanel(new GridBagLayout());
     495        JPanel panelTf = new JPanel(new GridBagLayout());
    494496
    495497        timezone = loadTimezone();
     
    503505        tfOffset.setText(delta.formatOffset());
    504506
    505         final var buttonViewGpsPhoto = new JButton(tr("<html>Use photo of an accurate clock,<br>e.g. GPS receiver display</html>"));
     507        JButton buttonViewGpsPhoto = new JButton(tr("<html>Use photo of an accurate clock,<br>e.g. GPS receiver display</html>"));
    506508        buttonViewGpsPhoto.setIcon(ImageProvider.get("clock"));
    507509        buttonViewGpsPhoto.addActionListener(new SetOffsetActionListener());
    508510
    509         final var buttonAutoGuess = new JButton(tr("Auto-Guess"));
     511        JButton buttonAutoGuess = new JButton(tr("Auto-Guess"));
    510512        buttonAutoGuess.setToolTipText(tr("Matches first photo with first gpx point"));
    511513        buttonAutoGuess.addActionListener(new AutoGuessActionListener());
    512514
    513         final var buttonAdjust = new JButton(tr("Manual adjust"));
     515        JButton buttonAdjust = new JButton(tr("Manual adjust"));
    514516        buttonAdjust.addActionListener(new AdjustActionListener());
    515517
    516         final var buttonAdvanced = new JButton(tr("Advanced settings..."));
     518        JButton buttonAdvanced = new JButton(tr("Advanced settings..."));
    517519        buttonAdvanced.addActionListener(new AdvancedSettingsActionListener());
    518520
    519         final var labelPosition = new JLabel(tr("Override position for: "));
     521        JLabel labelPosition = new JLabel(tr("Override position for: "));
    520522
    521523        int numAll = yLayer.getSortedImgList(true, true).size();
     
    535537        cbShowThumbs.setEnabled(!yLayer.thumbsLoaded);
    536538
    537         var y = 0;
    538         var gbc = GBC.eol();
     539        int y = 0;
     540        GBC gbc = GBC.eol();
    539541        gbc.gridx = 0;
    540542        gbc.gridy = y++;
     
    625627        expertChanged(ExpertToggleAction.isExpert());
    626628
    627         final var statusBar = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
     629        final JPanel statusBar = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    628630        statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
    629631        statusBarText = new JLabel(" ");
     
    631633        statusBar.add(statusBarText);
    632634
    633         final var repaintTheMap = new RepaintTheMapListener(yLayer);
     635        RepaintTheMapListener repaintTheMap = new RepaintTheMapListener(yLayer);
    634636        pDirectionPosition.addFocusListenerOnComponent(repaintTheMap);
    635637        tfTimezone.addFocusListener(repaintTheMap);
     
    811813        public void actionPerformed(ActionEvent e) {
    812814
    813             final var offset = GpxTimeOffset.milliseconds(
     815            final GpxTimeOffset offset = GpxTimeOffset.milliseconds(
    814816                    delta.getMilliseconds() + Math.round(timezone.getHours() * TimeUnit.HOURS.toMillis(1)));
    815817            final int dayOffset = offset.getDayOffset();
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r18947 r19050  
    119119    private boolean destroyed;
    120120
    121     private class UpdateImageThread extends Thread {
     121    private final class UpdateImageThread extends Thread {
    122122        private boolean restart;
    123123
     
    146146        if (e == null ||
    147147            e.getKey().equals(AGPIFO_STYLE.getKey())) {
    148             dragButton = AGPIFO_STYLE.get() ? 1 : 3;
     148            dragButton = Boolean.TRUE.equals(AGPIFO_STYLE.get()) ? 1 : 3;
    149149            zoomButton = dragButton == 1 ? 3 : 1;
    150150        }
     
    320320    }
    321321
    322     private class ImgDisplayMouseListener extends MouseAdapter {
     322    private final class ImgDisplayMouseListener extends MouseAdapter {
    323323
    324324        private MouseEvent lastMouseEvent;
     
    434434                return;
    435435
    436             if (ZOOM_ON_CLICK.get()) {
     436            if (Boolean.TRUE.equals(ZOOM_ON_CLICK.get())) {
    437437                // click notions are less coherent than wheel, refresh mousePointInImg on each click
    438438                lastMouseEvent = null;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/RemoteEntry.java

    r19048 r19050  
    296296    @Override
    297297    public InputStream getInputStream() throws IOException {
    298         final var u = getImageURI();
     298        final URI u = getImageURI();
    299299        if (u.getScheme().contains("file")) {
    300300            return Files.newInputStream(Paths.get(u));
    301301        }
    302         final var client = HttpClient.create(u.toURL());
     302        final HttpClient client = HttpClient.create(u.toURL());
    303303        InputStream actual = client.connect().getContent();
    304304        return new BufferedInputStream(actual) {
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r18801 r19050  
    6060    }
    6161
    62     private static class Markers {
     62    private static final class Markers {
    6363        public boolean timedMarkersOmitted;
    6464        public boolean untimedMarkersOmitted;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r18871 r19050  
    715715        @Override
    716716        public String toString() {
    717             return "LinkSelector{conditions=" + getConditions() + '}';
     717            return "LinkSelector{conditions=" + super.getConditions() + '}';
    718718        }
    719719    }
     
    761761         */
    762762        private static String checkBase(String base) {
    763             switch(base) {
     763            switch (base) {
    764764            case "*": return BASE_ANY;
    765765            case "node": return BASE_NODE;
     
    844844            return base
    845845                    + (Range.ZERO_TO_INFINITY.equals(range) ? "" : range)
    846                     + getConditions().stream().map(String::valueOf).collect(Collectors.joining(""))
     846                    + super.getConditions().stream().map(String::valueOf).collect(Collectors.joining(""))
    847847                    + (subpart != null && subpart != Subpart.DEFAULT_SUBPART ? ("::" + subpart) : "");
    848848        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java

    r19048 r19050  
    167167        /* Is joining an array really that complicated in Java? */
    168168        private static String[] getDefaultNameTags() {
    169             final var tags = new ArrayList<String>(Arrays.asList(LanguageInfo.getOSMLocaleCodes("name:")));
     169            final var tags = new ArrayList<>(Arrays.asList(LanguageInfo.getOSMLocaleCodes("name:")));
    170170            tags.addAll(Arrays.asList("name",
    171171                    "int_name",
     
    249249
    250250        private String getPrimitiveName(IPrimitive n) {
    251             final var name = new StringBuilder();
     251            StringBuilder name = new StringBuilder();
    252252            if (!n.hasKeys()) return null;
    253253            nameTags.stream().map(n::get).filter(Objects::nonNull).findFirst()
  • trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedure.java

    r17600 r19050  
    3636     */
    3737    public String getText() {
    38         switch(this) {
     38        switch (this) {
    3939        case FULLY_AUTOMATIC:
    4040            return tr("Fully automatic");
     
    5252     */
    5353    public String getDescription() {
    54         switch(this) {
     54        switch (this) {
    5555        case FULLY_AUTOMATIC:
    5656            return tr(
  • trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java

    r19008 r19050  
    99import java.awt.FlowLayout;
    1010import java.awt.Font;
     11import java.awt.GridBagConstraints;
    1112import java.awt.GridBagLayout;
    1213import java.awt.event.ActionEvent;
     
    170171        );
    171172        pnlMessage.enableClickableHyperlinks();
    172         pnl.add(pnlMessage, GBC.eol().fill(GBC.HORIZONTAL));
     173        pnl.add(pnlMessage, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    173174
    174175        // the authorisation procedure
     
    201202     */
    202203    protected void refreshAuthorisationProcedurePanel() {
    203         switch(procedure) {
     204        switch (procedure) {
    204205        case FULLY_AUTOMATIC:
    205206            spAuthorisationProcedureUI.getViewport().setView(pnlFullyAutomaticAuthorisationUI);
     
    290291
    291292    protected AbstractAuthorizationUI getCurrentAuthorisationUI() {
    292         switch(procedure) {
     293        switch (procedure) {
    293294        case FULLY_AUTOMATIC: return pnlFullyAutomaticAuthorisationUI;
    294295        case MANUALLY: return pnlManualAuthorisationUI;
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r18972 r19050  
    409409    }
    410410
    411     private static class ActionParametersTableModel extends AbstractTableModel {
     411    private static final class ActionParametersTableModel extends AbstractTableModel {
    412412
    413413        private transient ActionDefinition currentAction = ActionDefinition.getSeparator();
     
    494494    }
    495495
    496     private class ToolbarPopupMenu extends JPopupMenu {
     496    private final class ToolbarPopupMenu extends JPopupMenu {
    497497        private transient ActionDefinition act;
    498498
     
    750750        }
    751751
    752         private class ActionDefinitionModel extends DefaultListModel<ActionDefinition> implements ReorderableTableModel<ActionDefinition> {
     752        private final class ActionDefinitionModel extends DefaultListModel<ActionDefinition> implements ReorderableTableModel<ActionDefinition> {
    753753            @Override
    754754            public ListSelectionModel getSelectionModel() {
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java

    r18801 r19050  
    1818import javax.swing.JTable;
    1919import javax.swing.JToolBar;
     20import javax.swing.SwingConstants;
    2021import javax.swing.event.ListSelectionEvent;
    2122import javax.swing.event.ListSelectionListener;
     
    103104    }
    104105
    105     private class EntryListener implements ListSelectionListener {
     106    private final class EntryListener implements ListSelectionListener {
    106107        @Override
    107108        public void valueChanged(ListSelectionEvent e) {
     
    132133        left.add(scroll, GBC.eol().fill());
    133134
    134         JToolBar sideButtonTB = new JToolBar(JToolBar.HORIZONTAL);
     135        JToolBar sideButtonTB = new JToolBar(SwingConstants.HORIZONTAL);
    135136        sideButtonTB.setBorderPainted(false);
    136137        sideButtonTB.setOpaque(false);
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListListEditor.java

    r12881 r19050  
    5050    }
    5151
    52     private class EntryListModel extends AbstractEntryListModel {
     52    private final class EntryListModel extends AbstractEntryListModel {
    5353
    5454        @Override
     
    6464        @Override
    6565        public void add() {
    66             data.add(new ArrayList<String>());
     66            data.add(new ArrayList<>());
    6767            fireIntervalAdded(this, getSize() - 1, getSize() - 1);
    6868        }
     
    7575    }
    7676
    77     private class ListTableModel extends AbstractTableModel {
     77    private final class ListTableModel extends AbstractTableModel {
    7878
    7979        private List<String> data() {
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java

    r18224 r19050  
    7878    }
    7979
    80     private class EntryListModel extends AbstractEntryListModel {
     80    private final class EntryListModel extends AbstractEntryListModel {
    8181
    8282        @Override
     
    9292        @Override
    9393        public void add() {
    94             dataKeys.add(new ArrayList<String>());
    95             dataValues.add(new ArrayList<String>());
     94            dataKeys.add(new ArrayList<>());
     95            dataValues.add(new ArrayList<>());
    9696            dataLabels.add("");
    9797            fireIntervalAdded(this, getSize() - 1, getSize() - 1);
     
    107107    }
    108108
    109     private class MapTableModel extends AbstractTableModel {
     109    private final class MapTableModel extends AbstractTableModel {
    110110
    111111        private List<List<String>> data() {
    112             return entryIdx == null ? Collections.<List<String>>emptyList() : Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx));
     112            return entryIdx == null ? Collections.emptyList() : Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx));
    113113        }
    114114
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/WMSLayerTree.java

    r17602 r19050  
    107107    }
    108108
    109     private static class LayerTreeCellRenderer extends DefaultTreeCellRenderer {
     109    private static final class LayerTreeCellRenderer extends DefaultTreeCellRenderer {
    110110        @Override
    111111        public Component getTreeCellRendererComponent(JTree tree, Object value,
     
    124124    }
    125125
    126     private class WMSTreeSelectionListener implements TreeSelectionListener {
     126    private final class WMSTreeSelectionListener implements TreeSelectionListener {
    127127
    128128        @Override
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeSelectionPanel.java

    r17768 r19050  
    55
    66import java.awt.Dimension;
     7import java.awt.GridBagConstraints;
    78import java.awt.GridBagLayout;
    89import java.awt.event.ActionListener;
     
    6061     * List model for the filtered view on the list of all codes.
    6162     */
    62     private class ProjectionCodeModel extends AbstractTableModel {
     63    private final class ProjectionCodeModel extends AbstractTableModel {
    6364        @Override
    6465        public int getRowCount() {
     
    105106
    106107        this.setLayout(new GridBagLayout());
    107         this.add(filter, GBC.eol().fill(GBC.HORIZONTAL).weight(1.0, 0.0));
    108         this.add(scroll, GBC.eol().fill(GBC.HORIZONTAL));
     108        this.add(filter, GBC.eol().fill(GridBagConstraints.HORIZONTAL).weight(1.0, 0.0));
     109        this.add(scroll, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    109110    }
    110111
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java

    r18173 r19050  
    55
    66import java.awt.Font;
     7import java.awt.GridBagConstraints;
    78import java.awt.GridBagLayout;
    89import java.awt.event.ActionEvent;
     
    8384
    8485        // the checkbox for the default UL
    85         add(buildDefaultServerUrlPanel(), GBC.eop().fill(GBC.HORIZONTAL));
     86        add(buildDefaultServerUrlPanel(), GBC.eop().fill(GridBagConstraints.HORIZONTAL));
    8687
    8788        // the input field for the URL
    8889        add(lblApiUrl, GBC.std().insets(0, 0, 3, 0));
    89         add(tfOsmServerUrl, GBC.std().fill(GBC.HORIZONTAL).insets(0, 0, 3, 0));
     90        add(tfOsmServerUrl, GBC.std().fill(GridBagConstraints.HORIZONTAL).insets(0, 0, 3, 0));
    9091        lblApiUrl.setLabelFor(tfOsmServerUrl);
    9192        SelectAllOnFocusGainedDecorator.decorate(tfOsmServerUrl.getEditorComponent());
     
    257258        @Override
    258259        public void itemStateChanged(ItemEvent e) {
    259             switch(e.getStateChange()) {
     260            switch (e.getStateChange()) {
    260261            case ItemEvent.SELECTED:
    261262                setApiUrlInputEnabled(false);
  • trunk/src/org/openstreetmap/josm/gui/progress/AbstractProgressMonitor.java

    r18365 r19050  
    1212public abstract class AbstractProgressMonitor implements ProgressMonitor {
    1313
    14     private static class Request {
     14    private static final class Request {
    1515        private AbstractProgressMonitor originator;
    1616        private int childTicks;
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java

    r17595 r19050  
    9898        }
    9999
    100         switch(vColIndex) {
     100        switch (vColIndex) {
    101101            case 0: renderTagName((TagModel) value); break;
    102102            case 1: renderTagValue((TagModel) value); break;
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java

    r18801 r19050  
    6060     * Creates a new tag editor model. Internally allocates two selection models
    6161     * for row selection and column selection.
    62      *
     62     * <p>
    6363     * To create a {@link javax.swing.JTable} with this model:
    6464     * <pre>
     
    157157        TagModel tag = get(row);
    158158        if (tag != null) {
    159             switch(col) {
     159            switch (col) {
    160160            case 0:
    161161                updateTagName(tag, (String) value);
     
    219219    /**
    220220     * adds a tag given by a name/value pair to the tag editor model.
    221      *
     221     * <p>
    222222     * If there is no tag with name <code>name</code> yet, a new {@link TagModel} is created
    223223     * and append to this model.
    224      *
     224     * <p>
    225225     * If there is a tag with name <code>name</code>, <code>value</code> is merged to the list
    226226     * of values for this tag.
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java

    r18283 r19050  
    99import java.awt.Window;
    1010import java.awt.event.ActionEvent;
     11import java.awt.event.InputEvent;
    1112import java.awt.event.KeyEvent;
    1213import java.beans.PropertyChangeEvent;
     
    134135     * Action to be run when the user invokes a delete action on the table, for
    135136     * instance by pressing DEL.
    136      *
     137     * <p>
    137138     * Depending on the shape on the current selection the action deletes individual
    138139     * values or entire tags from the model.
    139      *
     140     * <p>
    140141     * If the current selection consists of cells in the second column only, the keys of
    141142     * the selected tags are set to the empty string.
    142      *
     143     * <p>
    143144     * If the current selection consists of cell in the third column only, the values of the
    144145     * selected tags are set to the empty string.
    145      *
     146     * <p>
    146147     *  If the current selection consists of cells in the second and the third column,
    147148     *  the selected tags are removed from the model.
    148      *
     149     * <p>
    149150     *  This action listens to the table selection. It becomes enabled when the selection
    150151     *  is non-empty, otherwise it is disabled.
    151      *
    152      *
    153152     */
    154153    class DeleteAction extends AbstractAction implements ListSelectionListener {
     
    190189            if (!isEnabled())
    191190                return;
    192             switch(getSelectedColumnCount()) {
     191            switch (getSelectedColumnCount()) {
    193192            case 1:
    194193                if (getSelectedColumn() == 0) {
     
    351350        addAction = new AddAction();
    352351        getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
    353         .put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK), "addTag");
     352            .put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_DOWN_MASK), "addTag");
    354353        getActionMap().put("addTag", addAction);
    355354
     
    566565     * This is a custom implementation of the CellEditorRemover used in JTable
    567566     * to handle the client property <code>terminateEditOnFocusLost</code>.
    568      *
     567     * <p>
    569568     * This implementation also checks whether focus is transferred to one of a list
    570569     * of dedicated components, see {@link TagTable#doNotStopCellEditingWhenFocused}.
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompEvent.java

    r18801 r19050  
    8080    public String paramString() {
    8181        String typeStr;
    82         switch(id) {
     82        switch (id) {
    8383            case AUTOCOMP_BEFORE:
    8484                typeStr = "AUTOCOMP_BEFORE";
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetMenu.java

    r18871 r19050  
    3838    public JMenu menu; // set by TaggingPresets
    3939
    40     private static class PresetTextComparator implements Comparator<JMenuItem>, Serializable {
     40    private static final class PresetTextComparator implements Comparator<JMenuItem>, Serializable {
    4141        private static final long serialVersionUID = 1L;
    4242        @Override
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r18824 r19050  
    7575    private final transient PresetClassifications classifications = new PresetClassifications();
    7676
    77     private static class ResultListCellRenderer implements ListCellRenderer<TaggingPreset> {
     77    private static final class ResultListCellRenderer implements ListCellRenderer<TaggingPreset> {
    7878        private final DefaultListCellRenderer def = new DefaultListCellRenderer();
    7979        @Override
  • trunk/src/org/openstreetmap/josm/gui/util/AdjustmentSynchronizer.java

    r10611 r19050  
    5959    @Override
    6060    public void adjustmentValueChanged(AdjustmentEvent e) {
    61         if (!enabledMap.get(e.getAdjustable()))
     61        if (Boolean.FALSE.equals(enabledMap.get(e.getAdjustable())))
    6262            return;
    6363        for (Adjustable a : synchronizedAdjustables) {
     
    123123        //
    124124        view.addItemListener(e -> {
    125             switch(e.getStateChange()) {
     125            switch (e.getStateChange()) {
    126126            case ItemEvent.SELECTED:
    127127                if (!isParticipatingInSynchronizedScrolling(adjustable)) {
  • trunk/src/org/openstreetmap/josm/gui/util/MultikeyActionsHandler.java

    r14248 r19050  
    111111    }
    112112
    113     private class MyKeyEventDispatcher implements KeyEventDispatcher {
     113    private final class MyKeyEventDispatcher implements KeyEventDispatcher {
    114114        @Override
    115115        public boolean dispatchKeyEvent(KeyEvent e) {
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmTextField.java

    r19048 r19050  
    55import java.awt.ComponentOrientation;
    66import java.awt.Font;
     7import java.awt.FontMetrics;
    78import java.awt.Graphics;
    89import java.awt.Graphics2D;
     
    1819
    1920import javax.swing.Icon;
     21import javax.swing.JTextField;
     22import javax.swing.RepaintManager;
    2023import javax.swing.JMenuItem;
    2124import javax.swing.JPopupMenu;
    22 import javax.swing.JTextField;
    23 import javax.swing.RepaintManager;
    2425import javax.swing.UIManager;
    2526import javax.swing.text.BadLocationException;
     
    254255     */
    255256    public static Color getHintTextColor() {
    256         var color = UIManager.getColor("TextField[Disabled].textForeground"); // Nimbus?
     257        Color color = UIManager.getColor("TextField[Disabled].textForeground"); // Nimbus?
    257258        if (color == null)
    258259            color = UIManager.getColor("TextField.inactiveForeground");
     
    305306            g.drawString(getHint(), x, getBaseline(getWidth(), getHeight()));
    306307        } else {
    307             final var metrics = g.getFontMetrics(g.getFont());
     308            FontMetrics metrics = g.getFontMetrics(g.getFont());
    308309            int dx = metrics.stringWidth(getHint());
    309310            g.drawString(getHint(), x - dx, getBaseline(getWidth(), getHeight()));
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitPane.java

    r12445 r19050  
    154154    }
    155155
    156     private class DefaultDividerPainter implements DividerPainter {
     156    private final class DefaultDividerPainter implements DividerPainter {
    157157        @Override
    158158        public void paint(Graphics g, Divider divider) {
     
    344344    }
    345345
    346     private class InputHandler extends MouseInputAdapter implements KeyListener {
     346    private final class InputHandler extends MouseInputAdapter implements KeyListener {
    347347
    348348        @Override
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r17787 r19050  
    243243     */
    244244    public byte[] getByteContent() throws IOException {
    245         return Utils.readBytesFromStream(getInputStream());
     245        return getInputStream().readAllBytes();
    246246    }
    247247
  • trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java

    r18801 r19050  
    500500            for (Entry<String, String> entry: queryParams.entrySet()) {
    501501                String k = entry.getKey();
    502                 switch(k) {
     502                switch (k) {
    503503                case "uid":
    504504                    if (queryParams.containsKey("display_name"))
     
    521521                case "time":
    522522                    Instant[] dates = parseTime(entry.getValue());
    523                     switch(dates.length) {
     523                    switch (dates.length) {
    524524                    case 1:
    525525                        csQuery.closedAfter(dates[0]);
  • trunk/src/org/openstreetmap/josm/io/ChangesetUpdater.java

    r17717 r19050  
    3535    private static volatile ScheduledFuture<?> task;
    3636
    37     private static class Worker implements Runnable {
     37    private static final class Worker implements Runnable {
    3838
    3939        private long lastTimeInMillis;
  • trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java

    r18801 r19050  
    167167    }
    168168
    169     private class Parser extends DefaultHandler {
     169    private final class Parser extends DefaultHandler {
    170170        private Locator locator;
    171171
     
    175175        }
    176176
    177         protected void throwException(String msg) throws XmlParsingException {
     177        void throwException(String msg) throws XmlParsingException {
    178178            throw new XmlParsingException(msg).rememberLocation(locator);
    179179        }
  • trunk/src/org/openstreetmap/josm/io/FileWatcher.java

    r17526 r19050  
    3535    private final Map<Path, SourceEntry> sourceMap = new HashMap<>();
    3636
    37     private static class InstanceHolder {
     37    private static final class InstanceHolder {
    3838        static final FileWatcher INSTANCE = new FileWatcher();
    3939    }
  • trunk/src/org/openstreetmap/josm/io/GpxParser.java

    r19049 r19050  
    142142    public void startElement(String namespaceURI, String localName, String qName, Attributes attributes) throws SAXException {
    143143        elements.push(new String[] {namespaceURI, localName, qName});
    144         switch(currentState) {
     144        switch (currentState) {
    145145            case INIT:
    146146                startElementInit(attributes);
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r18399 r19050  
    388388    private void wayPoint(WayPoint pnt, int mode) {
    389389        String type;
    390         switch(mode) {
     390        switch (mode) {
    391391        case WAY_POINT:
    392392            type = "wpt";
  • trunk/src/org/openstreetmap/josm/io/MessageNotifier.java

    r18991 r19050  
    7070    private static volatile ScheduledFuture<?> task;
    7171
    72     private static class Worker implements Runnable {
     72    private static final class Worker implements Runnable {
    7373
    7474        private int lastUnreadCount;
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r18821 r19050  
    135135    public void append(PrimitiveId id) {
    136136        if (id.isNew()) return;
    137         switch(id.getType()) {
     137        switch (id.getType()) {
    138138        case NODE: nodes.add(id.getUniqueId()); break;
    139139        case WAY: ways.add(id.getUniqueId()); break;
  • trunk/src/org/openstreetmap/josm/io/NameFinder.java

    r16643 r19050  
    238238     * Structure of xml described here:  http://wiki.openstreetmap.org/index.php/Name_finder
    239239     */
    240     private static class NameFinderResultParser extends DefaultHandler {
     240    private static final class NameFinderResultParser extends DefaultHandler {
    241241        private SearchResult currentResult;
    242242        private StringBuilder description;
  • trunk/src/org/openstreetmap/josm/io/NoteReader.java

    r19048 r19050  
    8282                notes = new ArrayList<>(10_000);
    8383                return;
     84            default: // Keep going
    8485            }
    8586
     
    169170            case "comment":
    170171                break;
     172            default: // Keep going (return)
    171173            }
    172174        }
     
    179181
    180182    static LatLon parseLatLon(UnaryOperator<String> attrs) {
    181         final var lat = Double.parseDouble(attrs.apply("lat"));
    182         final var lon = Double.parseDouble(attrs.apply("lon"));
     183        final double lat = Double.parseDouble(attrs.apply("lat"));
     184        final double lon = Double.parseDouble(attrs.apply("lon"));
    183185        return new LatLon(lat, lon);
    184186    }
     
    197199
    198200    static Note parseNoteFull(UnaryOperator<String> attrs) {
    199         final var note = parseNoteBasic(attrs);
     201        final Note note = parseNoteBasic(attrs);
    200202        String id = attrs.apply("id");
    201203        if (id != null) {
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r18991 r19050  
    809809                errorHeader = errorHeader == null ? null : errorHeader.trim();
    810810                String errorBody = responseBody.isEmpty() ? null : responseBody.trim();
    811                 switch(retCode) {
     811                switch (retCode) {
    812812                case HttpURLConnection.HTTP_OK:
    813813                    return responseBody;
  • trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java

    r17720 r19050  
    5959    }
    6060
    61     private class Parser extends DefaultHandler {
     61    private final class Parser extends DefaultHandler {
    6262        private Locator locator;
    6363
     
    6767        }
    6868
    69         protected void throwException(String msg) throws XmlParsingException {
     69        void throwException(String msg) throws XmlParsingException {
    7070            throw new XmlParsingException(msg).rememberLocation(locator);
    7171        }
     
    8080        private StringBuilder text;
    8181
    82         protected void parseChangesetAttributes(Attributes atts) throws XmlParsingException {
     82        void parseChangesetAttributes(Attributes atts) throws XmlParsingException {
    8383            // -- id
    8484            String value = atts.getValue("id");
     
    248248        }
    249249
    250         protected User createUser(Attributes atts) throws XmlParsingException {
     250        User createUser(Attributes atts) throws XmlParsingException {
    251251            String name = atts.getValue("user");
    252252            String uid = atts.getValue("uid");
  • trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java

    r18871 r19050  
    3535    private final HistoryDataSet data;
    3636
    37     private class Parser extends AbstractParser {
     37    private final class Parser extends AbstractParser {
    3838
    39         protected String getCurrentPosition() {
     39        String getCurrentPosition() {
    4040            if (locator == null)
    4141                return "";
  • trunk/src/org/openstreetmap/josm/io/OsmPbfReader.java

    r19048 r19050  
    9494            inputStream = new BoundedInputStream(new BufferedInputStream(source));
    9595        }
    96         try (var parser = new ProtobufParser(inputStream)) {
    97             final var baos = new ByteArrayOutputStream();
     96        try (ProtobufParser parser = new ProtobufParser(inputStream)) {
     97            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    9898            HeaderBlock headerBlock = null;
    9999            BlobHeader blobHeader = null;
     
    106106                    }
    107107                    // OSM PBF is fun -- it has *nested* pbf data
    108                     final var blob = parseBlob(blobHeader, inputStream, parser, baos);
     108                    final Blob blob = parseBlob(blobHeader, inputStream, parser, baos);
    109109                    headerBlock = parseHeaderBlock(blob, baos);
    110110                    checkRequiredFeatures(headerBlock);
     
    114114                        throw new IllegalStateException("A header block must occur before the first data block");
    115115                    }
    116                     final var blob = parseBlob(blobHeader, inputStream, parser, baos);
     116                    final Blob blob = parseBlob(blobHeader, inputStream, parser, baos);
    117117                    parseDataBlock(baos, headerBlock, blob);
    118118                    blobHeader = null;
     
    138138        byte[] indexData = null;
    139139        int datasize = Integer.MIN_VALUE;
    140         var length = 0;
     140        int length = 0;
    141141        long start = cis.getCount();
    142142        while (parser.hasNext() && (length == 0 || cis.getCount() - start < length)) {
    143             final var current = new ProtobufRecord(baos, parser);
     143            final ProtobufRecord current = new ProtobufRecord(baos, parser);
    144144            switch (current.getField()) {
    145145                case 1:
     
    239239    @Nonnull
    240240    private static HeaderBlock parseHeaderBlock(Blob blob, ByteArrayOutputStream baos) throws IOException {
    241         try (var blobInput = blob.inputStream();
    242              var parser = new ProtobufParser(blobInput)) {
     241        try (InputStream blobInput = blob.inputStream();
     242             ProtobufParser parser = new ProtobufParser(blobInput)) {
    243243            BBox bbox = null;
    244             final var required = new ArrayList<String>();
    245             final var optional = new ArrayList<String>();
     244            List<String> required = new ArrayList<>();
     245            List<String> optional = new ArrayList<>();
    246246            String program = null;
    247247            String source = null;
     
    250250            String osmosisReplicationBaseUrl = null;
    251251            while (parser.hasNext()) {
    252                 final var current = new ProtobufRecord(baos, parser);
     252                final ProtobufRecord current = new ProtobufRecord(baos, parser);
    253253                switch (current.getField()) {
    254254                    case 1: // bbox
     
    311311        String[] stringTable = null; // field 1, note that stringTable[0] is a delimiter, so it is always blank and unused
    312312        // field 2 -- we cannot parse these live just in case the following fields come later
    313         final var primitiveGroups = new ArrayList<ProtobufRecord>();
    314         var granularity = 100; // field 17
     313        final List<ProtobufRecord> primitiveGroups = new ArrayList<>();
     314        int granularity = 100; // field 17
    315315        long latOffset = 0; // field 19
    316316        long lonOffset = 0; // field 20
    317         var dateGranularity = 1000; // field 18, default is milliseconds since the 1970 epoch
    318         try (var inputStream = blob.inputStream();
    319              var parser = new ProtobufParser(inputStream)) {
     317        int dateGranularity = 1000; // field 18, default is milliseconds since the 1970 epoch
     318        try (InputStream inputStream = blob.inputStream();
     319             ProtobufParser parser = new ProtobufParser(inputStream)) {
    320320            while (parser.hasNext()) {
    321                 final var protobufRecord = new ProtobufRecord(baos, parser);
     321                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    322322                switch (protobufRecord.getField()) {
    323323                    case 1:
     
    343343            }
    344344        }
    345         final var primitiveBlockRecord = new PrimitiveBlockRecord(stringTable, granularity, latOffset, lonOffset,
     345        final PrimitiveBlockRecord primitiveBlockRecord = new PrimitiveBlockRecord(stringTable, granularity, latOffset, lonOffset,
    346346                dateGranularity);
    347         final var ds = getDataSet();
     347        final DataSet ds = getDataSet();
    348348        if (!primitiveGroups.isEmpty() && headerBlock.bbox() != null) {
    349349            try {
     
    375375    @Nullable
    376376    private static BBox parseBBox(ByteArrayOutputStream baos, ProtobufRecord current) throws IOException {
    377         try (var bboxInputStream = new ByteArrayInputStream(current.getBytes());
    378              var bboxParser = new ProtobufParser(bboxInputStream)) {
     377        try (ByteArrayInputStream bboxInputStream = new ByteArrayInputStream(current.getBytes());
     378             ProtobufParser bboxParser = new ProtobufParser(bboxInputStream)) {
    379379            double left = Double.NaN;
    380380            double right = Double.NaN;
     
    382382            double bottom = Double.NaN;
    383383            while (bboxParser.hasNext()) {
    384                 final var protobufRecord = new ProtobufRecord(baos, bboxParser);
     384                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, bboxParser);
    385385                if (protobufRecord.getType() == WireType.VARINT) {
    386386                    double value = protobufRecord.asSignedVarInt().longValue() * NANO_DEGREES;
     
    419419    @Nonnull
    420420    private static String[] parseStringTable(ByteArrayOutputStream baos, byte[] bytes) throws IOException {
    421         try (var is = new ByteArrayInputStream(bytes);
    422              var parser = new ProtobufParser(is)) {
    423             final var list = new ArrayList<String>();
     421        try (ByteArrayInputStream is = new ByteArrayInputStream(bytes);
     422             ProtobufParser parser = new ProtobufParser(is)) {
     423            final List<String> list = new ArrayList<>();
    424424            while (parser.hasNext()) {
    425                 final var protobufRecord = new ProtobufRecord(baos, parser);
     425                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    426426                if (protobufRecord.getField() == 1) {
    427427                    list.add(protobufRecord.asString().intern()); // field is technically repeated bytes
     
    444444    private void parsePrimitiveGroup(ByteArrayOutputStream baos, byte[] bytes, PrimitiveBlockRecord primitiveBlockRecord)
    445445            throws IllegalDataException, IOException {
    446         try (var bais = new ByteArrayInputStream(bytes);
    447              var parser = new ProtobufParser(bais)) {
     446        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     447             ProtobufParser parser = new ProtobufParser(bais)) {
    448448            while (parser.hasNext()) {
    449                 final var protobufRecord = new ProtobufRecord(baos, parser);
     449                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    450450                switch (protobufRecord.getField()) {
    451451                    case 1: // Nodes, repeated
     
    480480    private void parseNode(ByteArrayOutputStream baos, byte[] bytes, PrimitiveBlockRecord primitiveBlockRecord)
    481481            throws IllegalDataException, IOException {
    482         try (var bais = new ByteArrayInputStream(bytes);
    483              var parser = new ProtobufParser(bais)) {
     482        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     483             ProtobufParser parser = new ProtobufParser(bais)) {
    484484            long id = Long.MIN_VALUE;
    485             final var keys = new ArrayList<String>();
    486             final var values = new ArrayList<String>();
     485            final List<String> keys = new ArrayList<>();
     486            final List<String> values = new ArrayList<>();
    487487            Info info = null;
    488488            long lat = Long.MIN_VALUE;
    489489            long lon = Long.MIN_VALUE;
    490490            while (parser.hasNext()) {
    491                 final var protobufRecord = new ProtobufRecord(baos, parser);
     491                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    492492                switch (protobufRecord.getField()) {
    493493                    case 1:
     
    519519                throw new IllegalDataException("OSM PBF did not provide all the required node information");
    520520            }
    521             final var node = new NodeData(id);
     521            final NodeData node = new NodeData(id);
    522522            node.setCoor(calculateLatLon(primitiveBlockRecord, lat, lon));
    523523            addTags(node, keys, values);
     
    547547        long[] keyVals = EMPTY_LONG; // technically can be int
    548548        Info[] denseInfo = null;
    549         try (var bais = new ByteArrayInputStream(bytes);
    550              var parser = new ProtobufParser(bais)) {
     549        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     550             ProtobufParser parser = new ProtobufParser(bais)) {
    551551            while (parser.hasNext()) {
    552                 final var protobufRecord = new ProtobufRecord(baos, parser);
     552                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    553553                switch (protobufRecord.getField()) {
    554554                    case 1: // packed node ids, DELTA encoded
     
    576576        }
    577577
    578         var keyValIndex = 0; // This index must not reset between nodes, and must always increment
     578        int keyValIndex = 0; // This index must not reset between nodes, and must always increment
    579579        if (ids.length == lats.length && lats.length == lons.length && (denseInfo == null || denseInfo.length == lons.length)) {
    580580            long id = 0;
    581581            long lat = 0;
    582582            long lon = 0;
    583             for (var i = 0; i < ids.length; i++) {
     583            for (int i = 0; i < ids.length; i++) {
    584584                final NodeData node;
    585585                id += ids[i];
    586586                node = new NodeData(id);
    587587                if (denseInfo != null) {
    588                     final var info = denseInfo[i];
     588                    final Info info = denseInfo[i];
    589589                    setOsmPrimitiveData(primitiveBlockRecord, node, info);
    590590                } else {
     
    638638        // We don't do live drawing, so we don't care about lats and lons (we essentially throw them away with the current parser)
    639639        // This is for the optional feature "LocationsOnWays"
    640         try (var bais = new ByteArrayInputStream(bytes);
    641              var parser = new ProtobufParser(bais)) {
     640        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     641             ProtobufParser parser = new ProtobufParser(bais)) {
    642642            while (parser.hasNext()) {
    643                 final var protobufRecord = new ProtobufRecord(baos, parser);
     643                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    644644                switch (protobufRecord.getField()) {
    645645                    case 1:
     
    672672            throw new IllegalDataException("A way with either no id or no nodes was found");
    673673        }
    674         final var wayData = new WayData(id);
    675         final var nodeIds = new ArrayList<Long>(refs.length);
     674        final WayData wayData = new WayData(id);
     675        final List<Long> nodeIds = new ArrayList<>(refs.length);
    676676        long ref = 0;
    677677        for (long tRef : refs) {
     
    701701            throws IllegalDataException, IOException {
    702702        long id = Long.MIN_VALUE;
    703         final var keys = new ArrayList<String>();
    704         final var values = new ArrayList<String>();
     703        final List<String> keys = new ArrayList<>();
     704        final List<String> values = new ArrayList<>();
    705705        Info info = null;
    706706        long[] rolesStringId = EMPTY_LONG; // Technically int
    707707        long[] memids = EMPTY_LONG;
    708708        long[] types = EMPTY_LONG; // Technically an enum
    709         try (var bais = new ByteArrayInputStream(bytes);
    710              var parser = new ProtobufParser(bais)) {
     709        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     710             ProtobufParser parser = new ProtobufParser(bais)) {
    711711            while (parser.hasNext()) {
    712                 final var protobufRecord = new ProtobufRecord(baos, parser);
     712                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    713713                switch (protobufRecord.getField()) {
    714714                    case 1:
     
    747747            throw new IllegalDataException("OSM PBF contains a bad relation definition");
    748748        }
    749         final var data = new RelationData(id);
     749        final RelationData data = new RelationData(id);
    750750        if (info != null) {
    751751            setOsmPrimitiveData(primitiveBlockRecord, data, info);
     
    757757        List<RelationMemberData> members = new ArrayList<>(rolesStringId.length);
    758758        long memberId = 0;
    759         for (var i = 0; i < rolesStringId.length; i++) {
     759        for (int i = 0; i < rolesStringId.length; i++) {
    760760            String role = primitiveBlockRecord.stringTable[(int) rolesStringId[i]];
    761761            memberId += memids[i];
     
    777777    @Nonnull
    778778    private static Info parseInfo(ByteArrayOutputStream baos, byte[] bytes) throws IOException {
    779         try (var bais = new ByteArrayInputStream(bytes);
    780              var parser = new ProtobufParser(bais)) {
     779        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     780             ProtobufParser parser = new ProtobufParser(bais)) {
    781781            int version = -1;
    782782            Long timestamp = null;
     
    784784            Integer uid = null;
    785785            Integer userSid = null;
    786             var visible = true;
     786            boolean visible = true;
    787787            while (parser.hasNext()) {
    788                 final var protobufRecord = new ProtobufRecord(baos, parser);
     788                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    789789                switch (protobufRecord.getField()) {
    790790                    case 1:
     
    839839        }
    840840        Map<String, String> tagMap = new HashMap<>(keys.size());
    841         for (var i = 0; i < keys.size(); i++) {
     841        for (int i = 0; i < keys.size(); i++) {
    842842            tagMap.put(keys.get(i), values.get(i));
    843843        }
     
    879879    @Nonnull
    880880    private static long[] decodePackedSInt64(long[] numbers) {
    881         for (var i = 0; i < numbers.length; i++) {
     881        for (int i = 0; i < numbers.length; i++) {
    882882            numbers[i] = ProtobufParser.decodeZigZag(numbers[i]);
    883883        }
     
    922922        long[] userSid = EMPTY_LONG; // technically int
    923923        long[] visible = EMPTY_LONG; // optional, true if not set, technically booleans
    924         try (var bais = new ByteArrayInputStream(bytes);
    925              var parser = new ProtobufParser(bais)) {
     924        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     925             ProtobufParser parser = new ProtobufParser(bais)) {
    926926            while (parser.hasNext()) {
    927                 final var protobufRecord = new ProtobufRecord(baos, parser);
     927                final ProtobufRecord protobufRecord = new ProtobufRecord(baos, parser);
    928928                switch (protobufRecord.getField()) {
    929929                    case 1:
     
    956956        }
    957957        if (version.length > 0) {
    958             final var infos = new Info[version.length];
     958            final Info[] infos = new Info[version.length];
    959959            long lastTimestamp = 0; // delta encoded
    960960            long lastChangeset = 0; // delta encoded
    961961            long lastUid = 0; // delta encoded,
    962962            long lastUserSid = 0; // delta encoded, string id for username
    963             for (var i = 0; i < version.length; i++) {
     963            for (int i = 0; i < version.length; i++) {
    964964                if (timestamp.length > i)
    965965                    lastTimestamp += timestamp[i];
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r12743 r19050  
    9999            for (OsmPrimitive osm : primitives) {
    100100                String msg;
    101                 switch(OsmPrimitiveType.from(osm)) {
     101                switch (OsmPrimitiveType.from(osm)) {
    102102                case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break;
    103103                case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break;
     
    207207            }
    208208            api.setChangeset(changeset);
    209             switch(strategy.getStrategy()) {
     209            switch (strategy.getStrategy()) {
    210210            case SINGLE_REQUEST_STRATEGY:
    211211                uploadChangesAsDiffUpload(primitives, monitor.createSubTaskMonitor(0, false));
  • trunk/src/org/openstreetmap/josm/io/UploadStrategySpecification.java

    r18283 r19050  
    137137        if (numObjects <= 0)
    138138            return 0;
    139         switch(strategy) {
     139        switch (strategy) {
    140140        case INDIVIDUAL_OBJECTS_STRATEGY: return numObjects;
    141141        case SINGLE_REQUEST_STRATEGY: return 1;
  • trunk/src/org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java

    r18991 r19050  
    1111import java.util.Set;
    1212
    13 import jakarta.json.JsonException;
    1413import javax.swing.text.html.HTMLEditorKit;
    1514
     
    2423import org.openstreetmap.josm.spi.preferences.Config;
    2524import org.openstreetmap.josm.tools.Utils;
     25
     26import jakarta.json.JsonException;
    2627
    2728/**
     
    4142        String user;
    4243        String password;
    43         switch(requestorType) {
     44        switch (requestorType) {
    4445        case SERVER:
    4546            if (Objects.equals(OsmApi.getOsmApi().getHost(), host)) {
     
    7374        if (requestorType == null)
    7475            return;
    75         switch(requestorType) {
     76        switch (requestorType) {
    7677        case SERVER:
    7778            if (Objects.equals(OsmApi.getOsmApi().getHost(), host)) {
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r18871 r19050  
    112112    }
    113113
    114     private static class Parser extends DefaultHandler {
     114    private static final class Parser extends DefaultHandler {
    115115        private static final String MAX_ZOOM = "max-zoom";
    116116        private static final String MIN_ZOOM = "min-zoom";
     
    366366            case MIRROR_ATTRIBUTE:
    367367                if (mirrorEntry != null) {
    368                     switch(qName) {
     368                    switch (qName) {
    369369                    case "type":
    370370                        Optional<ImageryType> type = Arrays.stream(ImageryType.values())
     
    412412                break;
    413413            case ENTRY_ATTRIBUTE:
    414                 switch(qName) {
     414                switch (qName) {
    415415                case "name":
    416416                    entry.setName(lang == null ? LanguageInfo.getJOSMLocaleCode(null) : lang, accumulator.toString());
  • trunk/src/org/openstreetmap/josm/io/nmea/NmeaParser.java

    r18787 r19050  
    387387                if (!accu.isEmpty()) {
    388388                    int fixtype = Integer.parseInt(accu);
    389                     switch(fixtype) {
     389                    switch (fixtype) {
    390390                    case 0:
    391391                        currentwp.put(GpxConstants.PT_FIX, "none");
  • trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java

    r17715 r19050  
    7474    private static void handleElement(GpxImageEntry entry, Element attrElem) {
    7575        try {
    76             switch(attrElem.getTagName()) {
     76            switch (attrElem.getTagName()) {
    7777            case "file":
    7878                entry.setFile(new File(attrElem.getTextContent()));
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r18975 r19050  
    574574                        tr("Unable to load layer"),
    575575                        tr("Cannot load layer of type ''{0}'' because no suitable importer was found.", type),
    576                         JOptionPane.WARNING_MESSAGE,
    577                         progressMonitor
    578                         );
     576                        JOptionPane.WARNING_MESSAGE
     577                );
    579578                if (dialog.isCancel()) {
    580579                    progressMonitor.cancel();
     
    593592                                tr("Unable to load layer"),
    594593                                tr("Cannot load layer {0} because it depends on layer {1} which has been skipped.", idx, d),
    595                                 JOptionPane.WARNING_MESSAGE,
    596                                 progressMonitor
    597                                 );
     594                                JOptionPane.WARNING_MESSAGE
     595                        );
    598596                        if (dialog.isCancel()) {
    599597                            progressMonitor.cancel();
     
    625623                                        Utils.escapeReservedCharactersHTML(name),
    626624                                        Utils.escapeReservedCharactersHTML(exception.getMessage())),
    627                                 JOptionPane.ERROR_MESSAGE,
    628                                 progressMonitor
    629                                 );
     625                                JOptionPane.ERROR_MESSAGE
     626                        );
    630627                        if (dialog.isCancel()) {
    631628                            progressMonitor.cancel();
     
    735732     * needed to block the current thread and wait for the result of the modal dialog from EDT.
    736733     */
    737     private static class CancelOrContinueDialog {
     734    private static final class CancelOrContinueDialog {
    738735
    739736        private boolean cancel;
    740737
    741         public void show(final String title, final String message, final int icon, final ProgressMonitor progressMonitor) {
     738        void show(final String title, final String message, final int icon) {
    742739            try {
    743740                SwingUtilities.invokeAndWait(() -> {
  • trunk/src/org/openstreetmap/josm/plugins/Plugin.java

    r16553 r19050  
    2424 * For all purposes of loading dynamic resources, the Plugin's class loader should be used
    2525 * (or else, the plugin jar will not be within the class path).
    26  *
     26 * <p>
    2727 * A plugin may subclass this abstract base class (but it is optional).
    28  *
     28 * <p>
    2929 * The actual implementation of this class is optional, as all functions will be called
    3030 * via reflection. This is to be able to change this interface without the need of
     
    3232 * function here (or does provide a function with a mismatching signature), it will not
    3333 * be called. That simple.
    34  *
     34 * <p>
    3535 * Or in other words: See this base class as an documentation of what automatic callbacks
    3636 * are provided (you can register yourself to more callbacks in your plugin class
    3737 * constructor).
    38  *
     38 * <p>
    3939 * Subclassing Plugin and overriding some functions makes it easy for you to keep sync
    4040 * with the correct actual plugin architecture of JOSM.
     
    4747     * This is the info available for this plugin. You can access this from your
    4848     * constructor.
    49      *
     49     * <p>
    5050     * (The actual implementation to request the info from a static variable
    5151     * is a bit hacky, but it works).
     
    5555    private final IBaseDirectories pluginBaseDirectories = new PluginBaseDirectories();
    5656
    57     private class PluginBaseDirectories implements IBaseDirectories {
     57    private final class PluginBaseDirectories implements IBaseDirectories {
    5858        private File preferencesDir;
    5959        private File cacheDir;
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r18833 r19050  
    501501        //
    502502        String policy = Config.getPref().get(togglePreferenceKey, "ask").trim().toLowerCase(Locale.ENGLISH);
    503         switch(policy) {
     503        switch (policy) {
    504504        case "never":
    505505            if ("pluginmanager.version-based-update.policy".equals(togglePreferenceKey)) {
     
    552552
    553553        if (pnlMessage.isRememberDecision()) {
    554             switch(ret) {
     554            switch (ret) {
    555555            case 0:
    556556                Config.getPref().put(togglePreferenceKey, "always");
     
    16441644            + (!Utils.isEmpty(info.localversion) ? " Version: " + info.localversion : "");
    16451645            pluginTab.add(new JLabel(name), GBC.std());
    1646             pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
     1646            pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GridBagConstraints.HORIZONTAL));
    16471647            pluginTab.add(new JButton(new PluginInformationAction(info)), GBC.eol());
    16481648
     
    16571657            description.setCaretPosition(0);
    16581658
    1659             pluginTab.add(description, GBC.eop().fill(GBC.HORIZONTAL));
     1659            pluginTab.add(description, GBC.eop().fill(GridBagConstraints.HORIZONTAL));
    16601660        }
    16611661        return pluginTab;
  • trunk/src/org/openstreetmap/josm/tools/CopyList.java

    r10314 r19050  
    139139    }
    140140
    141     private class Itr implements Iterator<E> {
     141    private final class Itr implements Iterator<E> {
    142142        /**
    143143         * Index of element to be returned by subsequent call to next.
     
    198198        }
    199199
    200         final void checkForComodification() {
     200        void checkForComodification() {
    201201            if (modCount != expectedModCount)
    202202                throw new ConcurrentModificationException();
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r19043 r19050  
    646646
    647647    private static int pluralEval(long n) {
    648         switch(pluralMode) {
     648        switch (pluralMode) {
    649649        case MODE_NOTONE: /* bg, da, de, el, en, en_AU, en_CA, en_GB, es, et, eu, fi, gl, is, it, iw_IL, mr, nb, nl, sv */
    650650            return (n != 1) ? 1 : 0;
  • trunk/src/org/openstreetmap/josm/tools/ImageResizeMode.java

    r19048 r19050  
    8787     */
    8888    BufferedImage createBufferedImage(Dimension dim, Dimension icon, Consumer<Graphics2D> renderer, Image sourceIcon) {
    89         final var real = computeDimension(dim, icon);
    90         final var bufferedImage = new BufferedImage(real.width, real.height, BufferedImage.TYPE_INT_ARGB);
     89        final Dimension real = computeDimension(dim, icon);
     90        final BufferedImage bufferedImage = new BufferedImage(real.width, real.height, BufferedImage.TYPE_INT_ARGB);
    9191        final Graphics2D g = bufferedImage.createGraphics();
    9292        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  • trunk/src/org/openstreetmap/josm/tools/ListenerList.java

    r18466 r19050  
    224224    }
    225225
    226     private static class UncheckedListenerList<T> extends ListenerList<T> {
     226    private static final class UncheckedListenerList<T> extends ListenerList<T> {
    227227        @Override
    228228        protected void failAdd(T listener) {
  • trunk/src/org/openstreetmap/josm/tools/Logging.java

    r17820 r19050  
    130130
    131131        @Override
    132         public synchronized void publish(LogRecord record) {
    133             if (this.prioritizedHandler == null || !this.prioritizedHandler.isLoggable(record)) {
    134                 super.publish(record);
     132        public synchronized void publish(LogRecord logRecord) {
     133            if (this.prioritizedHandler == null || !this.prioritizedHandler.isLoggable(logRecord)) {
     134                super.publish(logRecord);
    135135            }
    136136        }
     
    481481    }
    482482
    483     private static class RememberWarningHandler extends Handler {
     483    private static final class RememberWarningHandler extends Handler {
    484484        private final String[] log = new String[10];
    485485        private int messagesLogged;
     
    491491
    492492        @Override
    493         public synchronized void publish(LogRecord record) {
     493        public synchronized void publish(LogRecord logRecord) {
    494494            // We don't use setLevel + isLoggable to work in WebStart Sandbox mode
    495             if (record.getLevel().intValue() < LEVEL_WARN.intValue()) {
     495            if (logRecord.getLevel().intValue() < LEVEL_WARN.intValue()) {
    496496                return;
    497497            }
    498498
    499             String msg = String.format(Locale.ROOT, "%09.3f %s%s", startup.elapsed() / 1000., getPrefix(record), record.getMessage());
     499            String msg = String.format(Locale.ROOT, "%09.3f %s%s", startup.elapsed() / 1000., getPrefix(logRecord), logRecord.getMessage());
    500500
    501501            // Only remember first line of message
     
    508508        }
    509509
    510         private static String getPrefix(LogRecord record) {
    511             if (record.getLevel().equals(LEVEL_WARN)) {
     510        private static String getPrefix(LogRecord logRecord) {
     511            if (logRecord.getLevel().equals(LEVEL_WARN)) {
    512512                return "W: ";
    513513            } else {
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r18871 r19050  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.event.InputEvent;
    67import java.awt.event.KeyEvent;
    78import java.util.ArrayList;
     
    246247    public void setAccelerator(AbstractAction action) {
    247248        if (getKeyStroke() != null) {
    248             action.putValue(AbstractAction.ACCELERATOR_KEY, getKeyStroke());
     249            action.putValue(Action.ACCELERATOR_KEY, getKeyStroke());
    249250        }
    250251    }
     
    266267    public static String getKeyText(KeyStroke keyStroke) {
    267268        if (keyStroke == null) return "";
    268         String modifText = KeyEvent.getModifiersExText(keyStroke.getModifiers());
     269        String modifText = InputEvent.getModifiersExText(keyStroke.getModifiers());
    269270        if (modifText.isEmpty()) return KeyEvent.getKeyText(keyStroke.getKeyCode());
    270271        return modifText + '+' + KeyEvent.getKeyText(keyStroke.getKeyCode());
     
    307308    private static final ShortcutCollection shortcuts = new ShortcutCollection();
    308309
    309     private static class ShortcutCollection extends CopyOnWriteArrayList<Shortcut> {
     310    private static final class ShortcutCollection extends CopyOnWriteArrayList<Shortcut> {
    310311        private static final long serialVersionUID = 1L;
    311312        @Override
     
    398399        int commandDownMask = PlatformManager.getPlatform().getMenuShortcutKeyMaskEx();
    399400        groups.put(NONE, -1);
    400         groups.put(MNEMONIC, KeyEvent.ALT_DOWN_MASK);
     401        groups.put(MNEMONIC, InputEvent.ALT_DOWN_MASK);
    401402        groups.put(DIRECT, 0);
    402         groups.put(ALT, KeyEvent.ALT_DOWN_MASK);
    403         groups.put(SHIFT, KeyEvent.SHIFT_DOWN_MASK);
     403        groups.put(ALT, InputEvent.ALT_DOWN_MASK);
     404        groups.put(SHIFT, InputEvent.SHIFT_DOWN_MASK);
    404405        groups.put(CTRL, commandDownMask);
    405         groups.put(ALT_SHIFT, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK);
    406         groups.put(ALT_CTRL, KeyEvent.ALT_DOWN_MASK | commandDownMask);
    407         groups.put(CTRL_SHIFT, commandDownMask | KeyEvent.SHIFT_DOWN_MASK);
    408         groups.put(ALT_CTRL_SHIFT, KeyEvent.ALT_DOWN_MASK | commandDownMask | KeyEvent.SHIFT_DOWN_MASK);
     406        groups.put(ALT_SHIFT, InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
     407        groups.put(ALT_CTRL, InputEvent.ALT_DOWN_MASK | commandDownMask);
     408        groups.put(CTRL_SHIFT, commandDownMask | InputEvent.SHIFT_DOWN_MASK);
     409        groups.put(ALT_CTRL_SHIFT, InputEvent.ALT_DOWN_MASK | commandDownMask | InputEvent.SHIFT_DOWN_MASK);
    409410
    410411        // (1) System reserved shortcuts
     
    567568    private static int findNewOsxModifier(int requestedGroup) {
    568569        switch (requestedGroup) {
    569             case CTRL: return KeyEvent.CTRL_DOWN_MASK;
    570             case ALT_CTRL: return KeyEvent.ALT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK;
    571             case CTRL_SHIFT: return KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK;
    572             case ALT_CTRL_SHIFT: return KeyEvent.ALT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK;
     570            case CTRL: return InputEvent.CTRL_DOWN_MASK;
     571            case ALT_CTRL: return InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK;
     572            case CTRL_SHIFT: return InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK;
     573            case ALT_CTRL_SHIFT: return InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK;
    573574            default: return 0;
    574575        }
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r19048 r19050  
    99import java.awt.font.FontRenderContext;
    1010import java.awt.font.GlyphVector;
    11 import java.io.ByteArrayOutputStream;
    1211import java.io.Closeable;
    1312import java.io.File;
     
    3029import java.nio.file.StandardCopyOption;
    3130import java.nio.file.attribute.BasicFileAttributes;
     31import java.nio.file.attribute.FileTime;
    3232import java.security.MessageDigest;
    3333import java.security.NoSuchAlgorithmException;
     
    152152     */
    153153    public static <T> int indexOf(Iterable<? extends T> collection, Predicate<? super T> predicate) {
    154         var i = 0;
    155         for (var item : collection) {
     154        int i = 0;
     155        for (T item : collection) {
    156156            if (predicate.test(item))
    157157                return i;
     
    168168     * @throws AssertionError if the condition is not met
    169169     */
    170     public static void ensure(boolean condition, String message, Object...data) {
     170    public static void ensure(boolean condition, String message, Object... data) {
    171171        if (!condition)
    172172            throw new AssertionError(
     
    185185        if (n <= 0)
    186186            throw new IllegalArgumentException("n must be <= 0 but is " + n);
    187         var res = a % n;
     187        int res = a % n;
    188188        if (res < 0) {
    189189            res += n;
     
    303303            Logging.warn("Unable to create directory "+out.getPath());
    304304        }
    305         var files = in.listFiles();
     305        File[] files = in.listFiles();
    306306        if (files != null) {
    307             for (var f : files) {
    308                 var target = new File(out, f.getName());
     307            for (File f : files) {
     308                File target = new File(out, f.getName());
    309309                if (f.isDirectory()) {
    310310                    copyDirectory(f, target);
     
    324324    public static boolean deleteDirectory(File path) {
    325325        if (path.exists()) {
    326             var files = path.listFiles();
     326            File[] files = path.listFiles();
    327327            if (files != null) {
    328                 for (var file : files) {
     328                for (File file : files) {
    329329                    if (file.isDirectory()) {
    330330                        deleteDirectory(file);
     
    371371     */
    372372    public static boolean deleteFile(File file, String warnMsg) {
    373         var result = file.delete();
     373        boolean result = file.delete();
    374374        if (!result) {
    375375            Logging.warn(tr(warnMsg, file.getPath()));
     
    397397     */
    398398    public static boolean mkDirs(File dir, String warnMsg) {
    399         var result = dir.mkdirs();
     399        boolean result = dir.mkdirs();
    400400        if (!result) {
    401401            Logging.warn(tr(warnMsg, dir.getPath()));
     
    497497            throw new JosmRuntimeException(e);
    498498        }
    499         var byteData = data.getBytes(StandardCharsets.UTF_8);
    500         var byteDigest = md.digest(byteData);
     499        byte[] byteData = data.getBytes(StandardCharsets.UTF_8);
     500        byte[] byteDigest = md.digest(byteData);
    501501        return toHexString(byteDigest);
    502502    }
     
    517517        }
    518518
    519         final var len = bytes.length;
     519        final int len = bytes.length;
    520520        if (len == 0) {
    521521            return "";
    522522        }
    523523
    524         var hexChars = new char[len * 2];
    525         var j = 0;
     524        char[] hexChars = new char[len * 2];
     525        int j = 0;
    526526        for (final int v : bytes) {
    527527            hexChars[j++] = HEX_ARRAY[(v & 0xf0) >> 4];
     
    541541     */
    542542    public static <T> List<T> topologicalSort(final MultiMap<T, T> dependencies) {
    543         var deps = new MultiMap<T, T>();
    544         for (var key : dependencies.keySet()) {
     543        MultiMap<T, T> deps = new MultiMap<>();
     544        for (T key : dependencies.keySet()) {
    545545            deps.putVoid(key);
    546             for (var val : dependencies.get(key)) {
     546            for (T val : dependencies.get(key)) {
    547547                deps.putVoid(val);
    548548                deps.put(key, val);
     
    550550        }
    551551
    552         var size = deps.size();
     552        int size = deps.size();
    553553        List<T> sorted = new ArrayList<>();
    554         for (var i = 0; i < size; ++i) {
    555             var parentless = deps.keySet().stream()
     554        for (int i = 0; i < size; ++i) {
     555            T parentless = deps.keySet().stream()
    556556                    .filter(key -> deps.get(key).isEmpty())
    557557                    .findFirst().orElse(null);
     
    559559            sorted.add(parentless);
    560560            deps.remove(parentless);
    561             for (var key : deps.keySet()) {
     561            for (T key : deps.keySet()) {
    562562                deps.remove(key, parentless);
    563563            }
     
    679679            return Collections.emptyMap();
    680680        } else if (map.size() == 1) {
    681             final var entry = map.entrySet().iterator().next();
     681            final Map.Entry<K, V> entry = map.entrySet().iterator().next();
    682682            return Collections.singletonMap(entry.getKey(), entry.getValue());
    683683        } else if (mapOfEntries != null) {
     
    795795        }
    796796
    797         var start = 0;
    798         var end = str.length();
    799         var leadingSkipChar = true;
     797        int start = 0;
     798        int end = str.length();
     799        boolean leadingSkipChar = true;
    800800        while (leadingSkipChar && start < end) {
    801801            leadingSkipChar = isStrippedChar(str.charAt(start), skipChars);
     
    804804            }
    805805        }
    806         var trailingSkipChar = true;
     806        boolean trailingSkipChar = true;
    807807        while (trailingSkipChar && end > start) {
    808808            trailingSkipChar = isStrippedChar(str.charAt(end - 1), skipChars);
     
    866866            Logging.debug(String.join(" ", command));
    867867        }
    868         var out = Files.createTempFile("josm_exec_" + command.get(0) + "_", ".txt");
     868        Path out = Files.createTempFile("josm_exec_" + command.get(0) + "_", ".txt");
    869869        try {
    870             var p = new ProcessBuilder(command).redirectErrorStream(true).redirectOutput(out.toFile()).start();
     870            Process p = new ProcessBuilder(command).redirectErrorStream(true).redirectOutput(out.toFile()).start();
    871871            if (!p.waitFor(timeout, unit) || p.exitValue() != 0) {
    872872                throw new ExecutionException(command.toString(), null);
     
    888888     */
    889889    public static File getJosmTempDir() {
    890         var tmpDir = getSystemProperty("java.io.tmpdir");
     890        String tmpDir = getSystemProperty("java.io.tmpdir");
    891891        if (tmpDir == null) {
    892892            return null;
    893893        }
    894         final var josmTmpDir = new File(tmpDir, "JOSM");
     894        final File josmTmpDir = new File(tmpDir, "JOSM");
    895895        if (!josmTmpDir.exists() && !josmTmpDir.mkdirs()) {
    896896            Logging.warn("Unable to create temp directory " + josmTmpDir);
     
    920920        // Is it less than 1 hour ?
    921921        if (elapsedTime < MILLIS_OF_HOUR) {
    922             final var min = elapsedTime / MILLIS_OF_MINUTE;
     922            final long min = elapsedTime / MILLIS_OF_MINUTE;
    923923            return String.format("%d %s %d %s", min, tr("min"), (elapsedTime - min * MILLIS_OF_MINUTE) / MILLIS_OF_SECOND, tr("s"));
    924924        }
    925925        // Is it less than 1 day ?
    926926        if (elapsedTime < MILLIS_OF_DAY) {
    927             final var hour = elapsedTime / MILLIS_OF_HOUR;
     927            final long hour = elapsedTime / MILLIS_OF_HOUR;
    928928            return String.format("%d %s %d %s", hour, tr("h"), (elapsedTime - hour * MILLIS_OF_HOUR) / MILLIS_OF_MINUTE, tr("min"));
    929929        }
    930         var days = elapsedTime / MILLIS_OF_DAY;
     930        long days = elapsedTime / MILLIS_OF_DAY;
    931931        return String.format("%d %s %d %s", days, trn("day", "days", days), (elapsedTime - days * MILLIS_OF_DAY) / MILLIS_OF_HOUR, tr("h"));
    932932    }
     
    943943            throw new IllegalArgumentException("bytes must be >= 0");
    944944        }
    945         var unitIndex = 0;
     945        int unitIndex = 0;
    946946        double value = bytes;
    947947        while (value >= 1024 && unitIndex < SIZE_UNITS.length) {
     
    967967    public static String getPositionListString(List<Integer> positionList) {
    968968        Collections.sort(positionList);
    969         final var sb = new StringBuilder(32);
     969        final StringBuilder sb = new StringBuilder(32);
    970970        sb.append(positionList.get(0));
    971         var cnt = 0;
     971        int cnt = 0;
    972972        int last = positionList.get(0);
    973         for (var i = 1; i < positionList.size(); ++i) {
     973        for (int i = 1; i < positionList.size(); ++i) {
    974974            int cur = positionList.get(i);
    975975            if (cur == last + 1) {
     
    10301030     */
    10311031    public static Throwable getRootCause(Throwable t) {
    1032         var result = t;
     1032        Throwable result = t;
    10331033        if (result != null) {
    1034             var cause = result.getCause();
     1034            Throwable cause = result.getCause();
    10351035            while (cause != null && !cause.equals(result)) {
    10361036                result = cause;
     
    10501050     */
    10511051    public static <T> T[] addInArrayCopy(T[] array, T item) {
    1052         var biggerCopy = Arrays.copyOf(array, array.length + 1);
     1052        T[] biggerCopy = Arrays.copyOf(array, array.length + 1);
    10531053        biggerCopy[array.length] = item;
    10541054        return biggerCopy;
     
    10631063     */
    10641064    public static String shortenString(String s, int maxLength) {
    1065         final var ellipses = "...";
     1065        final String ellipses = "...";
    10661066        CheckParameterUtil.ensureThat(maxLength >= ellipses.length(), "maxLength is shorter than " + ellipses.length());
    10671067        if (s != null && s.length() > maxLength) {
     
    11011101            if (elements.size() > maxElements) {
    11021102                final Collection<T> r = new ArrayList<>(maxElements);
    1103                 final var it = elements.iterator();
     1103                final Iterator<T> it = elements.iterator();
    11041104                while (r.size() < maxElements - 1) {
    11051105                    r.add(it.next());
     
    11261126            return url;
    11271127
    1128         final var query = url.substring(url.indexOf('?') + 1);
    1129 
    1130         final var sb = new StringBuilder(url.substring(0, url.indexOf('?') + 1));
    1131 
    1132         for (var i = 0; i < query.length(); i++) {
    1133             final var c = query.substring(i, i + 1);
     1128        final String query = url.substring(url.indexOf('?') + 1);
     1129
     1130        final StringBuilder sb = new StringBuilder(url.substring(0, url.indexOf('?') + 1));
     1131
     1132        for (int i = 0; i < query.length(); i++) {
     1133            final String c = query.substring(i, i + 1);
    11341134            if (URL_CHARS.contains(c)) {
    11351135                sb.append(c);
     
    11521152     */
    11531153    public static String encodeUrl(String s) {
    1154         final var enc = StandardCharsets.UTF_8.name();
     1154        final String enc = StandardCharsets.UTF_8.name();
    11551155        try {
    11561156            return URLEncoder.encode(s, enc);
     
    11721172     */
    11731173    public static String decodeUrl(String s) {
    1174         final var enc = StandardCharsets.UTF_8.name();
     1174        final String enc = StandardCharsets.UTF_8.name();
    11751175        try {
    11761176            return URLDecoder.decode(s, enc);
     
    12201220            @Override
    12211221            public Thread newThread(final Runnable runnable) {
    1222                 final var thread = new Thread(runnable, String.format(Locale.ENGLISH, nameFormat, count.getAndIncrement()));
     1222                final Thread thread = new Thread(runnable, String.format(Locale.ENGLISH, nameFormat, count.getAndIncrement()));
    12231223                thread.setPriority(threadPriority);
    12241224                return thread;
     
    12981298    public static boolean isSimilar(String string1, String string2) {
    12991299        // check plain strings
    1300         var distance = getLevenshteinDistance(string1, string2);
     1300        int distance = getLevenshteinDistance(string1, string2);
    13011301
    13021302        // check if only the case differs, so we don't consider large distance as different strings
     
    13391339        }
    13401340
    1341         for (var length : values) {
     1341        for (double length : values) {
    13421342            standardDeviation += Math.pow(length - mean, 2);
    13431343        }
     
    13601360        }
    13611361        List<int[]> groups = new ArrayList<>();
    1362         var current = new int[]{Integer.MIN_VALUE, Integer.MIN_VALUE};
     1362        int[] current = {Integer.MIN_VALUE, Integer.MIN_VALUE};
    13631363        groups.add(current);
    1364         for (var row : integers) {
     1364        for (int row : integers) {
    13651365            if (current[0] == Integer.MIN_VALUE) {
    13661366                current[0] = row;
     
    13971397    @SuppressWarnings("ThreadPriorityCheck")
    13981398    public static ForkJoinPool newForkJoinPool(String pref, final String nameFormat, final int threadPriority) {
    1399         final var noThreads = Config.getPref().getInt(pref, Runtime.getRuntime().availableProcessors());
     1399        final int noThreads = Config.getPref().getInt(pref, Runtime.getRuntime().availableProcessors());
    14001400        return new ForkJoinPool(noThreads, new ForkJoinPool.ForkJoinWorkerThreadFactory() {
    14011401            final AtomicLong count = new AtomicLong(0);
     
    14671467        if (value != null) {
    14681468            try {
    1469                 var old = System.setProperty(key, value);
     1469                String old = System.setProperty(key, value);
    14701470                if (Logging.isDebugEnabled() && !value.equals(old)) {
    14711471                    if (!key.toLowerCase(Locale.ENGLISH).contains("password")) {
     
    14931493     */
    14941494    public static boolean hasExtension(String filename, String... extensions) {
    1495         var name = filename.toLowerCase(Locale.ENGLISH).replace("?format=raw", "");
     1495        String name = filename.toLowerCase(Locale.ENGLISH).replace("?format=raw", "");
    14961496        return Arrays.stream(extensions)
    14971497                .anyMatch(ext -> name.endsWith('.' + ext.toLowerCase(Locale.ENGLISH)));
     
    15161516     * @return byte array of data in input stream (empty if stream is null)
    15171517     * @throws IOException if any I/O error occurs
    1518      */
     1518     * @deprecated since xxx -- use {@link InputStream#readAllBytes()} instead
     1519     */
     1520    @Deprecated
    15191521    public static byte[] readBytesFromStream(InputStream stream) throws IOException {
    1520         // TODO: remove this method when switching to Java 11 and use InputStream.readAllBytes
    15211522        if (stream == null) {
    15221523            return new byte[0];
    15231524        }
    1524         try (stream; var bout = new ByteArrayOutputStream(stream.available())) {
    1525             final var buffer = new byte[8192];
    1526             var finished = false;
    1527             do {
    1528                 var read = stream.read(buffer);
    1529                 if (read >= 0) {
    1530                     bout.write(buffer, 0, read);
    1531                 } else {
    1532                     finished = true;
    1533                 }
    1534             } while (!finished);
    1535             if (bout.size() == 0)
    1536                 return new byte[0];
    1537             return bout.toByteArray();
    1538         }
     1525        return stream.readAllBytes();
    15391526    }
    15401527
     
    16001587     */
    16011588    public static List<GlyphVector> getGlyphVectorsBidi(String string, Font font, FontRenderContext frc) {
    1602         final var gvs = new ArrayList<GlyphVector>();
    1603         final var bidi = new Bidi(string, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
    1604         final var levels = new byte[bidi.getRunCount()];
    1605         final var dirStrings = new DirectionString[levels.length];
    1606         for (var i = 0; i < levels.length; ++i) {
     1589        final List<GlyphVector> gvs = new ArrayList<>();
     1590        final Bidi bidi = new Bidi(string, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
     1591        final byte[] levels = new byte[bidi.getRunCount()];
     1592        final DirectionString[] dirStrings = new DirectionString[levels.length];
     1593        for (int i = 0; i < levels.length; ++i) {
    16071594            levels[i] = (byte) bidi.getRunLevel(i);
    1608             final var substr = string.substring(bidi.getRunStart(i), bidi.getRunLimit(i));
    1609             final var dir = levels[i] % 2 == 0 ? Bidi.DIRECTION_LEFT_TO_RIGHT : Bidi.DIRECTION_RIGHT_TO_LEFT;
     1595            final String substr = string.substring(bidi.getRunStart(i), bidi.getRunLimit(i));
     1596            final int dir = levels[i] % 2 == 0 ? Bidi.DIRECTION_LEFT_TO_RIGHT : Bidi.DIRECTION_RIGHT_TO_LEFT;
    16101597            dirStrings[i] = new DirectionString(dir, substr);
    16111598        }
    16121599        Bidi.reorderVisually(levels, 0, dirStrings, 0, levels.length);
    1613         for (var dirString : dirStrings) {
    1614             var chars = dirString.str.toCharArray();
     1600        for (DirectionString dirString : dirStrings) {
     1601            final char[] chars = dirString.str.toCharArray();
    16151602            gvs.add(font.layoutGlyphVector(frc, chars, 0, chars.length, dirString.direction));
    16161603        }
     
    17091696    public static int getJavaVersion() {
    17101697        // Switch to Runtime.version() once we move past Java 8
    1711         var version = Objects.requireNonNull(getSystemProperty("java.version"));
     1698        String version = Objects.requireNonNull(getSystemProperty("java.version"));
    17121699        if (version.startsWith("1.")) {
    17131700            version = version.substring(2);
     
    17181705        // 9
    17191706        // 9.0.1
    1720         var dotPos = version.indexOf('.');
    1721         var dashPos = version.indexOf('-');
     1707        int dotPos = version.indexOf('.');
     1708        int dashPos = version.indexOf('-');
    17221709        return Integer.parseInt(version.substring(0,
    17231710                dotPos > -1 ? dotPos : dashPos > -1 ? dashPos : version.length()));
     
    17311718    public static int getJavaUpdate() {
    17321719        // Switch to Runtime.version() once we move past Java 8
    1733         var version = Objects.requireNonNull(getSystemProperty("java.version"));
     1720        String version = Objects.requireNonNull(getSystemProperty("java.version"));
    17341721        if (version.startsWith("1.")) {
    17351722            version = version.substring(2);
     
    17421729        // 17.0.4.1+1-LTS
    17431730        // $MAJOR.$MINOR.$SECURITY.$PATCH
    1744         var undePos = version.indexOf('_');
    1745         var dashPos = version.indexOf('-');
     1731        int undePos = version.indexOf('_');
     1732        int dashPos = version.indexOf('-');
    17461733        if (undePos > -1) {
    17471734            return Integer.parseInt(version.substring(undePos + 1,
    17481735                    dashPos > -1 ? dashPos : version.length()));
    17491736        }
    1750         var firstDotPos = version.indexOf('.');
    1751         var secondDotPos = version.indexOf('.', firstDotPos + 1);
     1737        int firstDotPos = version.indexOf('.');
     1738        int secondDotPos = version.indexOf('.', firstDotPos + 1);
    17521739        if (firstDotPos == secondDotPos) {
    17531740            return 0;
     
    17641751    public static int getJavaBuild() {
    17651752        // Switch to Runtime.version() once we move past Java 8
    1766         var version = Objects.requireNonNull(getSystemProperty("java.runtime.version"));
    1767         var bPos = version.indexOf('b');
    1768         var pPos = version.indexOf('+');
     1753        String version = Objects.requireNonNull(getSystemProperty("java.runtime.version"));
     1754        int bPos = version.indexOf('b');
     1755        int pPos = version.indexOf('+');
    17691756        try {
    17701757            return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1));
     
    17831770        try {
    17841771            Object value;
    1785             var c = Class.forName("com.sun.deploy.config.BuiltInProperties");
     1772            Class<?> c = Class.forName("com.sun.deploy.config.BuiltInProperties");
    17861773            try {
    17871774                value = c.getDeclaredField("JRE_EXPIRATION_DATE").get(null);
     
    18071794    public static String getJavaLatestVersion() {
    18081795        try {
    1809             var versions = HttpClient.create(
     1796            String[] versions = HttpClient.create(
    18101797                    new URL(Config.getPref().get(
    18111798                            "java.baseline.version.url",
     
    18131800                    .connect().fetchContent().split("\n", -1);
    18141801            if (getJavaVersion() <= 11 && isRunningWebStart()) { // OpenWebStart currently only has Java 11
    1815                 for (var version : versions) {
     1802                for (String version : versions) {
    18161803                    if (version.startsWith("11")) {
    18171804                        return version;
     
    18191806                }
    18201807            } else if (getJavaVersion() <= 17) {
    1821                 for (var version : versions) {
     1808                for (String version : versions) {
    18221809                    if (version.startsWith("17")) { // Use current Java LTS
    18231810                        return version;
     
    19421929                    return url.openStream();
    19431930                } catch (FileNotFoundException | InvalidPathException e) {
    1944                     final var betterUrl = betterJarUrl(url);
     1931                    final URL betterUrl = betterJarUrl(url);
    19451932                    if (betterUrl != null) {
    19461933                        try {
     
    19791966    public static URL betterJarUrl(URL jarUrl, URL defaultUrl) throws IOException {
    19801967        // Workaround to https://bugs.openjdk.java.net/browse/JDK-4523159
    1981         var urlPath = jarUrl.getPath().replace("%20", " ");
     1968        String urlPath = jarUrl.getPath().replace("%20", " ");
    19821969        if (urlPath.startsWith("file:/") && urlPath.split("!", -1).length > 2) {
    19831970            // Locate jar file
    1984             var index = urlPath.lastIndexOf("!/");
    1985             final var jarFile = Paths.get(urlPath.substring("file:/".length(), index));
    1986             var filename = jarFile.getFileName();
    1987             var jarTime = Files.readAttributes(jarFile, BasicFileAttributes.class).lastModifiedTime();
     1971            int index = urlPath.lastIndexOf("!/");
     1972            final Path jarFile = Paths.get(urlPath.substring("file:/".length(), index));
     1973            Path filename = jarFile.getFileName();
     1974            FileTime jarTime = Files.readAttributes(jarFile, BasicFileAttributes.class).lastModifiedTime();
    19881975            // Copy it to temp directory (hopefully free of exclamation mark) if needed (missing or older jar)
    1989             final var jarCopy = Paths.get(getSystemProperty("java.io.tmpdir")).resolve(filename);
     1976            final Path jarCopy = Paths.get(getSystemProperty("java.io.tmpdir")).resolve(filename);
    19901977            if (!jarCopy.toFile().exists() ||
    19911978                    Files.readAttributes(jarCopy, BasicFileAttributes.class).lastModifiedTime().compareTo(jarTime) < 0) {
     
    20262013            Logging.trace(e);
    20272014            try {
    2028                 final var betterUrl = betterJarUrl(cl.getResource(path));
     2015                final URL betterUrl = betterJarUrl(cl.getResource(path));
    20292016                if (betterUrl != null) {
    20302017                    return betterUrl.openStream();
  • trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r18796 r19050  
    6565    }
    6666
    67     private class Parser extends DefaultHandler {
     67    private final class Parser extends DefaultHandler {
    6868        private final Stack<Object> current = new Stack<>();
    6969        private StringBuilder characters = new StringBuilder(64);
     
    7878        }
    7979
    80         protected void throwException(Exception e) throws XmlParsingException {
     80        void throwException(Exception e) throws XmlParsingException {
    8181            throw new XmlParsingException(e).rememberLocation(locator);
    8282        }
  • trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportQueue.java

    r16916 r19050  
    8989    }
    9090
    91     private class BugReportDisplayRunnable implements Runnable {
     91    private final class BugReportDisplayRunnable implements Runnable {
    9292
    9393        private volatile boolean running = true;
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java

    r18888 r19050  
    180180    }
    181181
    182     private static class PerformanceTester {
     182    private static final class PerformanceTester {
    183183        public double scale = 0;
    184184        public LatLon center = LL_CITY;
  • trunk/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java

    r18870 r19050  
    8585    }
    8686
    87     private static class UploadDialogMock extends MockUp<UploadDialog> {
     87    private static final class UploadDialogMock extends MockUp<UploadDialog> {
    8888        @Mock
    8989        public void pack(final Invocation invocation) {
     
    101101
    102102        @Mock
    103         public final boolean isCanceled(final Invocation invocation) {
     103        public boolean isCanceled(final Invocation invocation) {
    104104            if (!GraphicsEnvironment.isHeadless()) {
    105105                return Boolean.TRUE.equals(invocation.proceed());
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java

    r18965 r19050  
    5151    private static final int HEIGHT = 600;
    5252
    53     private static class AlwaysDeleteCallback implements DeleteCommand.DeletionCallback {
     53    private static final class AlwaysDeleteCallback implements DeleteCommand.DeletionCallback {
    5454        @Override
    5555        public boolean checkAndConfirmOutlyingDelete(Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) {
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java

    r18870 r19050  
    157157    }
    158158
    159     private static class FakeOsmApiMocker extends MockUp<FakeOsmApi> {
     159    private static final class FakeOsmApiMocker extends MockUp<FakeOsmApi> {
    160160        Collection<Note> closed = new ArrayList<>();
    161161        Collection<Note> commented = new ArrayList<>();
  • trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java

    r18037 r19050  
    44import java.util.Arrays;
    55
     6import org.junit.jupiter.api.Test;
    67import org.openstreetmap.josm.TestUtils;
    78import org.openstreetmap.josm.data.coor.LatLon;
     
    1920import nl.jqno.equalsverifier.EqualsVerifier;
    2021import nl.jqno.equalsverifier.Warning;
    21 import org.junit.jupiter.api.Test;
    2222
    2323/**
     
    100100         * @return The way.
    101101         */
    102         public Way createWay(int id, Node...nodes) {
     102        public Way createWay(int id, Node... nodes) {
    103103            Way way = new Way();
    104104            way.setOsmId(id, 1);
     
    115115         * @return The relation.
    116116         */
    117         public Relation createRelation(int id, RelationMember...members) {
     117        public Relation createRelation(int id, RelationMember... members) {
    118118            Relation relation = new Relation(id, 1);
    119119            for (RelationMember member : members) {
  • trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJobTest.java

    r18106 r19050  
    8585    }
    8686
    87     private static class Listener implements ICachedLoaderListener {
     87    private static final class Listener implements ICachedLoaderListener {
    8888        private CacheEntryAttributes attributes;
    8989        private boolean ready;
     
    513513     */
    514514    @Test
    515     public void testCheckUsing304() throws IOException {
     515    void testCheckUsing304() throws IOException {
    516516        ICacheAccess<String, CacheEntry> cache = getCache();
    517517        long expires = TimeUnit.DAYS.toMillis(1);
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java

    r18870 r19050  
    457457    }
    458458
    459     private static class TestChangeListener implements GpxDataChangeListener {
     459    private static final class TestChangeListener implements GpxDataChangeListener {
    460460
    461461        private GpxDataChangeEvent lastEvent;
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJobTest.java

    r18106 r19050  
    9999    }
    100100
    101     private static class Listener implements TileLoaderListener {
     101    private static final class Listener implements TileLoaderListener {
    102102        private CacheEntryAttributes attributes;
    103103        private boolean ready;
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MapboxVectorTileSourceTest.java

    r18766 r19050  
    2727 */
    2828class MapboxVectorTileSourceTest implements TileSourceTest {
    29     private static class SelectLayerDialogMocker extends ExtendedDialogMocker {
     29    private static final class SelectLayerDialogMocker extends ExtendedDialogMocker {
    3030        int index;
    3131        @Override
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuth20AuthorizationTest.java

    r18991 r19050  
    1717import java.util.stream.Stream;
    1818
    19 import com.github.tomakehurst.wiremock.client.WireMock;
    20 import com.github.tomakehurst.wiremock.common.FileSource;
    21 import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
    22 import com.github.tomakehurst.wiremock.extension.Parameters;
    23 import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
    24 import com.github.tomakehurst.wiremock.http.FixedDelayDistribution;
    25 import com.github.tomakehurst.wiremock.http.HttpHeader;
    26 import com.github.tomakehurst.wiremock.http.HttpHeaders;
    27 import com.github.tomakehurst.wiremock.http.QueryParameter;
    28 import com.github.tomakehurst.wiremock.http.Request;
    29 import com.github.tomakehurst.wiremock.http.Response;
    30 import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
    31 import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    32 import com.github.tomakehurst.wiremock.matching.AnythingPattern;
    33 import com.github.tomakehurst.wiremock.matching.EqualToPattern;
    34 import com.github.tomakehurst.wiremock.matching.StringValuePattern;
    35 import mockit.Mock;
    36 import mockit.MockUp;
    3719import org.junit.jupiter.api.AfterEach;
    3820import org.junit.jupiter.api.BeforeEach;
     
    5032import org.openstreetmap.josm.tools.Logging;
    5133
     34import com.github.tomakehurst.wiremock.client.WireMock;
     35import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
     36import com.github.tomakehurst.wiremock.extension.ResponseTransformerV2;
     37import com.github.tomakehurst.wiremock.http.FixedDelayDistribution;
     38import com.github.tomakehurst.wiremock.http.HttpHeader;
     39import com.github.tomakehurst.wiremock.http.HttpHeaders;
     40import com.github.tomakehurst.wiremock.http.QueryParameter;
     41import com.github.tomakehurst.wiremock.http.Request;
     42import com.github.tomakehurst.wiremock.http.Response;
     43import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
     44import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
     45import com.github.tomakehurst.wiremock.matching.AnythingPattern;
     46import com.github.tomakehurst.wiremock.matching.EqualToPattern;
     47import com.github.tomakehurst.wiremock.matching.StringValuePattern;
     48import com.github.tomakehurst.wiremock.stubbing.ServeEvent;
     49import mockit.Mock;
     50import mockit.MockUp;
     51
    5252@BasicPreferences
    5353@HTTP
     
    7070    }
    7171
    72     private static class OAuthServerWireMock extends ResponseTransformer {
     72    private static final class OAuthServerWireMock implements ResponseTransformerV2 {
    7373        String stateToReturn;
    7474        ConnectionProblems connectionProblems = ConnectionProblems.NONE;
     75
    7576        @Override
    76         public Response transform(Request request, Response response, FileSource files, Parameters parameters) {
     77        public Response transform(Response response, ServeEvent serveEvent) {
     78            final var request = serveEvent.getRequest();
    7779            try {
    7880                if (request.getUrl().startsWith("/oauth2/authorize")) {
     
    158160    /**
    159161     * Set up the default wiremock information
    160      * @param wireMockRuntimeInfo The info to set up
    161162     */
    162163    @BeforeEach
    163     void setupWireMock(WireMockRuntimeInfo wireMockRuntimeInfo) {
     164    void setupWireMock() {
     165        final WireMockRuntimeInfo wireMockRuntimeInfo = wml.getRuntimeInfo();
    164166        Config.getPref().put("osm-server.url", wireMockRuntimeInfo.getHttpBaseUrl() + "/api/");
    165167        new MockUp<JosmUrls>() {
     
    195197
    196198    @Test
    197     void testAuthorize(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException {
     199    void testAuthorize() throws IOException {
    198200        final AtomicReference<Optional<IOAuthToken>> consumer = new AtomicReference<>();
    199         final HttpClient client = generateClient(wireMockRuntimeInfo, consumer);
     201        final HttpClient client = generateClient(wml.getRuntimeInfo(), consumer);
    200202        try {
    201203            HttpClient.Response response = client.connect();
     
    212214
    213215    @Test
    214     void testAuthorizeBadState(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException {
     216    void testAuthorizeBadState() throws IOException {
    215217        oauthServer.stateToReturn = "Bad_State";
    216218        final AtomicReference<Optional<IOAuthToken>> consumer = new AtomicReference<>();
    217         final HttpClient client = generateClient(wireMockRuntimeInfo, consumer);
     219        final HttpClient client = generateClient(wml.getRuntimeInfo(), consumer);
    218220        try {
    219221            HttpClient.Response response = client.connect();
     
    228230
    229231    @Test
    230     void testSocketTimeout(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     232    void testSocketTimeout() throws Exception {
    231233        // 1s before timeout
    232234        Config.getPref().putInt("socket.timeout.connect", 1);
     
    235237
    236238        final AtomicReference<Optional<IOAuthToken>> consumer = new AtomicReference<>();
    237         final HttpClient client = generateClient(wireMockRuntimeInfo, consumer)
     239        final HttpClient client = generateClient(wml.getRuntimeInfo(), consumer)
    238240                .setConnectTimeout(15_000).setReadTimeout(30_000);
    239241        try {
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r18870 r19050  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.projection;
     3
     4import static org.junit.jupiter.api.Assertions.fail;
    35
    46import java.io.BufferedReader;
     
    4547    private static final String PROJECTION_DATA_FILE = "nodist/data/projection/projection-regression-test-data";
    4648
    47     private static class TestData {
     49    private static final class TestData {
    4850        public String code;
    4951        public LatLon ll;
     
    185187        if (fail.length() > 0) {
    186188            System.err.println(fail);
    187             throw new AssertionError(fail.toString());
     189            fail(fail.toString());
    188190        }
    189191    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java

    r18866 r19050  
    324324    }
    325325
    326     private static class PasteMembersActionMock extends MockUp<PasteMembersAction> {
     326    private static final class PasteMembersActionMock extends MockUp<PasteMembersAction> {
    327327        @Mock
    328         protected void updateEnabledState() {
     328        public void updateEnabledState() {
    329329            // Do nothing
    330330        }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayersDialogTest.java

    r19011 r19050  
    162162    }
    163163
    164     private static class GraphicsEnvironmentMock extends MockUp<GraphicsEnvironment> {
     164    private static final class GraphicsEnvironmentMock extends MockUp<GraphicsEnvironment> {
    165165        @Mock
    166166        public static boolean isHeadless(Invocation invocation) {
     
    169169    }
    170170
    171     private static class SaveLayersDialogMock extends MockUp<SaveLayersDialog> {
     171    private static final class SaveLayersDialogMock extends MockUp<SaveLayersDialog> {
    172172        private final SaveLayersModel model = new SaveLayersModel();
    173173        private int getUserActionCalled = 0;
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java

    r18694 r19050  
    1919import javax.swing.JOptionPane;
    2020
    21 import com.github.tomakehurst.wiremock.client.WireMock;
    22 import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
    23 import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    24 import mockit.MockUp;
    2521import org.awaitility.Awaitility;
    2622import org.junit.jupiter.api.AfterEach;
     
    4440import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    4541
     42import com.github.tomakehurst.wiremock.client.WireMock;
     43import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
     44import mockit.MockUp;
     45
    4646/**
    4747 * Higher level tests of {@link PluginPreference} class.
     
    132132     */
    133133    @Test
    134     void testInstallWithoutUpdate(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     134    void testInstallWithoutUpdate() throws Exception {
    135135        final PluginServer pluginServer = new PluginServer(
    136136            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
     
    138138            new PluginServer.RemotePlugin(null, Collections.singletonMap("Plugin-Version", "2"), "irrelevant_plugin")
    139139        );
    140         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     140        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    141141        Config.getPref().putList("plugins", Collections.singletonList("dummy_plugin"));
    142142
     
    238238     */
    239239    @Test
    240     void testDisablePluginWithUpdatesAvailable(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     240    void testDisablePluginWithUpdatesAvailable() throws Exception {
    241241        final PluginServer pluginServer = new PluginServer(
    242242            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
     
    244244            new PluginServer.RemotePlugin(null, null, "irrelevant_plugin")
    245245        );
    246         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     246        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    247247        Config.getPref().putList("plugins", Arrays.asList("baz_plugin", "dummy_plugin"));
    248248
     
    346346     */
    347347    @Test
    348     void testUpdateOnlySelectedPlugin(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     348    void testUpdateOnlySelectedPlugin() throws Exception {
    349349        TestUtils.assumeWorkingJMockit();
    350350        final PluginServer pluginServer = new PluginServer(
     
    352352            new PluginServer.RemotePlugin(this.referenceBazJarNew)
    353353        );
    354         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     354        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    355355        Config.getPref().putList("plugins", Arrays.asList("baz_plugin", "dummy_plugin"));
    356356
     
    516516     */
    517517    @Test
    518     void testUpdateWithNoAvailableUpdates(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     518    void testUpdateWithNoAvailableUpdates() throws Exception {
    519519        TestUtils.assumeWorkingJMockit();
    520520        final PluginServer pluginServer = new PluginServer(
     
    523523            new PluginServer.RemotePlugin(null, Collections.singletonMap("Plugin-Version", "123"), "irrelevant_plugin")
    524524        );
    525         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     525        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    526526        Config.getPref().putList("plugins", Arrays.asList("baz_plugin", "dummy_plugin"));
    527527
     
    644644     */
    645645    @Test
    646     void testInstallWithoutRestartRequired(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     646    void testInstallWithoutRestartRequired() throws Exception {
    647647        TestUtils.assumeWorkingJMockit();
    648648        final boolean[] loadPluginsCalled = new boolean[] {false};
     
    665665            new PluginServer.RemotePlugin(this.referenceBazJarNew)
    666666        );
    667         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     667        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    668668        Config.getPref().putList("plugins", Collections.emptyList());
    669669
     
    756756    @AssumeRevision("Revision: 7000\n")
    757757    @Test
    758     void testInstallMultiVersion(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     758    void testInstallMultiVersion() throws Exception {
    759759        TestUtils.assumeWorkingJMockit();
    760760
     
    766766            ))
    767767        );
    768         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     768        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    769769        // need to actually serve this older jar from somewhere
    770770        pluginServerRule.stubFor(
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AuthorizationHandlerTest.java

    r18650 r19050  
    2020 */
    2121class AuthorizationHandlerTest {
    22     private static class TestAuthorizationConsumer implements AuthorizationHandler.AuthorizationConsumer {
     22    private static final class TestAuthorizationConsumer implements AuthorizationHandler.AuthorizationConsumer {
    2323        boolean validated;
    2424        boolean handled;
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java

    r18870 r19050  
    3434import com.github.tomakehurst.wiremock.client.WireMock;
    3535import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
    36 import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    3736
    3837/**
     
    110109     */
    111110    @Test
    112     void testUpdatePluginsDownloadBoth(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException {
     111    void testUpdatePluginsDownloadBoth() throws IOException {
    113112        TestUtils.assumeWorkingJMockit();
    114113        final PluginServer pluginServer = new PluginServer(
     
    116115            new PluginServer.RemotePlugin(this.referenceBazJarNew)
    117116        );
    118         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     117        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    119118        Config.getPref().putList("plugins", Arrays.asList("dummy_plugin", "baz_plugin"));
    120119
     
    172171     */
    173172    @Test
    174     void testUpdatePluginsSkipOne(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException {
     173    void testUpdatePluginsSkipOne() throws IOException {
    175174        TestUtils.assumeWorkingJMockit();
    176175        final PluginServer pluginServer = new PluginServer(
     
    178177            new PluginServer.RemotePlugin(this.referenceBazJarNew)
    179178        );
    180         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     179        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    181180        Config.getPref().putList("plugins", Arrays.asList("dummy_plugin", "baz_plugin"));
    182181
     
    244243     */
    245244    @Test
    246     void testUpdatePluginsUnexpectedlyJOSMTooOld(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException {
     245    void testUpdatePluginsUnexpectedlyJOSMTooOld() throws IOException {
    247246        TestUtils.assumeWorkingJMockit();
    248247        final PluginServer pluginServer = new PluginServer(
     
    250249            new PluginServer.RemotePlugin(this.referenceBazJarNew, Collections.singletonMap("Plugin-Mainversion", "5500"))
    251250        );
    252         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     251        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    253252        Config.getPref().putList("plugins", Collections.singletonList("baz_plugin"));
    254253
     
    299298    @Test
    300299    @AssumeRevision("Revision: 7200\n")
    301     void testUpdatePluginsMultiVersionInsufficient(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOException {
     300    void testUpdatePluginsMultiVersionInsufficient() throws IOException {
    302301        TestUtils.assumeWorkingJMockit();
    303302
     
    308307            ))
    309308        );
    310         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     309        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    311310        Config.getPref().putList("plugins", Arrays.asList("qux_plugin", "baz_plugin"));
    312311
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java

    r18870 r19050  
    9191    @AssumeRevision("Revision: 7501\n")
    9292    @Test
    93     void testUpdatePluginsOneMultiVersion(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     93    void testUpdatePluginsOneMultiVersion() throws Exception {
    9494        TestUtils.assumeWorkingJMockit();
    9595
    9696        final String quxNewerServePath = "/qux/newer.jar";
    97         final Map<String, String> attrOverrides = new HashMap<String, String>() {{
     97        final Map<String, String> attrOverrides = new HashMap<>() {{
    9898            put("7500_Plugin-Url", "432;" + pluginServerRule.url(quxNewerServePath));
    9999            put("7499_Plugin-Url", "346;" + pluginServerRule.url("/not/served.jar"));
     
    104104            new PluginServer.RemotePlugin(this.referenceQuxJarNewest, attrOverrides)
    105105        );
     106        final WireMockRuntimeInfo wireMockRuntimeInfo = pluginServerRule.getRuntimeInfo();
    106107        pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
    107108        // need to actually serve this older jar from somewhere
     
    158159    @AssumeRevision("Revision: 7000\n")
    159160    @Test
    160     void testUpdatePluginsExistingVersionLatestPossible(WireMockRuntimeInfo wireMockRuntimeInfo) throws Exception {
     161    void testUpdatePluginsExistingVersionLatestPossible() throws Exception {
    161162        TestUtils.assumeWorkingJMockit();
    162163
    163         final Map<String, String> attrOverrides = new HashMap<String, String>() {{
     164        final Map<String, String> attrOverrides = new HashMap<>() {{
    164165            put("7500_Plugin-Url", "432;" + pluginServerRule.url("/dont.jar"));
    165166            put("7499_Plugin-Url", "346;" + pluginServerRule.url("/even.jar"));
     
    170171            new PluginServer.RemotePlugin(this.referenceQuxJarNewest, attrOverrides)
    171172        );
    172         pluginServer.applyToWireMockServer(wireMockRuntimeInfo);
     173        pluginServer.applyToWireMockServer(pluginServerRule.getRuntimeInfo());
    173174        Config.getPref().putList("plugins", Arrays.asList("qux_plugin", "baz_plugin"));
    174175
  • trunk/test/unit/org/openstreetmap/josm/spi/lifecycle/LifecycleTest.java

    r18893 r19050  
    1919@Projection
    2020class LifecycleTest {
    21     private static class InitStatusListenerStub implements InitStatusListener {
     21    private static final class InitStatusListenerStub implements InitStatusListener {
    2222
    2323        boolean updated;
  • trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java

    r18870 r19050  
    4646    }
    4747
    48     private static void testGetWikiLanguagePrefixes(LanguageInfo.LocaleType type, String...expected) {
     48    private static void testGetWikiLanguagePrefixes(LanguageInfo.LocaleType type, String... expected) {
    4949        final List<String> actual = Stream.of(EN_NZ, DE_DE, PT_BR, CA_ES_VALENCIA, ZN_CN, ZN_TW, AST, EN_GB, RU, NB)
    5050                .map(locale -> LanguageInfo.getWikiLanguagePrefix(locale, type))
Note: See TracChangeset for help on using the changeset viewer.