Ignore:
Timestamp:
2015-05-03T18:34:33+02:00 (10 years ago)
Author:
Don-vip
Message:

fix various Sonar issues:

  • squid:S1068: Unused private fields should be removed
  • squid:S1155: Collection.isEmpty() should be used to test for emptiness
  • squid:S1185: Overriding methods should do more than simply call the same method in the super class
  • squid:S1694: An abstract class should have both abstract and concrete methods
  • squid:S1905: Redundant casts should not be used
  • squid:S2065: Fields in non-serializable classes should not be "transient"
  • squid:S2583: Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"
  • squid:ModifiersOrderCheck: Modifiers should be declared in the correct order
Location:
trunk/src/org/openstreetmap/josm/actions
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r7850 r8318  
    286286                    neighbors.add(nodes.get(i+1));
    287287                }
    288             if(neighbors.size() == 0)
     288            if(neighbors.isEmpty())
    289289                continue;
    290290            else if(neighbors.size() == 2)
  • TabularUnified trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r8308 r8318  
    121121                }
    122122            }
    123             if (tmpNodes.size() < 1) {
     123            if (tmpNodes.isEmpty()) {
    124124                if (selection.size() > 1) {
    125125                    errMsg =  tr("None of these nodes are glued to anything else.");
     
    262262     */
    263263    private boolean checkSelection2(Collection<? extends OsmPrimitive> selection) {
    264         if (selection.size() < 1)
     264        if (selection.isEmpty())
    265265            return false;
    266266
     
    286286        }
    287287
    288         if (selectedNodes.size() < 1) {
     288        if (selectedNodes.isEmpty()) {
    289289            selectedNodes.addAll(selectedWay.getNodes());
    290290        }
  • TabularUnified trunk/src/org/openstreetmap/josm/actions/UploadNotesAction.java

    r7937 r8318  
    3636        }
    3737        NoteLayer layer;
    38         if (noteLayers != null && noteLayers.size() > 0) {
     38        if (noteLayers != null && !noteLayers.isEmpty()) {
    3939            layer = noteLayers.get(0);
    4040        } else {
  • TabularUnified trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java

    r8218 r8318  
    114114            }
    115115            NoteLayer layer;
    116             if (noteLayers != null && noteLayers.size() > 0) {
     116            if (noteLayers != null && !noteLayers.isEmpty()) {
    117117                layer = noteLayers.get(0);
    118118                layer.getNoteData().addNotes(notesData);
  • TabularUnified trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesUrlIdTask.java

    r8240 r8318  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     4import static org.openstreetmap.josm.tools.I18n.tr;
    55
    66import java.util.concurrent.Future;
     
    88import java.util.regex.Pattern;
    99
    10 import static org.openstreetmap.josm.tools.I18n.tr;
     10import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1111
    1212public class DownloadNotesUrlIdTask extends DownloadNotesTask {
     
    2929    }
    3030
    31     public boolean acceptsUrl(String url) {
    32         return super.acceptsUrl(url);
    33     }
    34 
    3531    @Override
    3632    public String getTitle() {
  • TabularUnified trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r8308 r8318  
    612612            startImproving(wayList.get(0));
    613613            return;
    614         } else if (nodeList.size() > 0) {
     614        } else if (nodeList.size() == 1) {
    615615            // Starting improving the only way of the single selected node
    616             if (nodeList.size() == 1) {
    617                 List<OsmPrimitive> r = nodeList.get(0).getReferrers();
    618                 if (r.size() == 1 && (r.get(0) instanceof Way)) {
    619                     startImproving((Way) r.get(0));
    620                     return;
    621                 }
     616            List<OsmPrimitive> r = nodeList.get(0).getReferrers();
     617            if (r.size() == 1 && (r.get(0) instanceof Way)) {
     618                startImproving((Way) r.get(0));
     619                return;
    622620            }
    623621        }
  • TabularUnified trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r8308 r8318  
    519519            // highlight it and adjust the cursor accordingly.
    520520            final boolean canMerge = ctrl && !getCurrentDataSet().getSelectedNodes().isEmpty();
    521             final OsmPrimitive p = canMerge ? (OsmPrimitive)findNodeToMergeTo(e.getPoint()) : null;
     521            final OsmPrimitive p = canMerge ? findNodeToMergeTo(e.getPoint()) : null;
    522522            boolean needsRepaint = removeHighlighting();
    523523            if(p != null) {
Note: See TracChangeset for help on using the changeset viewer.