Changeset 19050 in josm


Ignore:
Timestamp:
2024-04-22T20:59:26+02:00 (5 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