Changeset 10659 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2016-07-27T02:48:44+02:00 (8 years ago)
Author:
Don-vip
Message:

see #12472 - fix more warnings, increase maximum number of reported warnings from 100 to 1000

Location:
trunk/src/org/openstreetmap/josm
Files:
17 edited

Legend:

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

    r10467 r10659  
    1313import java.util.LinkedList;
    1414import java.util.List;
     15import java.util.Objects;
    1516import java.util.Set;
    1617
     
    313314        Node lastNode = null;
    314315        Way lastWay = null;
    315         while (firstNode != lastNode) {
     316        while (!Objects.equals(firstNode, lastNode)) {
    316317            if (lastNode == null) lastNode = firstNode;
    317318            for (Way way: ways) {
    318                 if (way == lastWay) continue;
    319                 if (way.firstNode() == lastNode) {
     319                if (Objects.equals(way, lastWay)) continue;
     320                if (Objects.equals(way.firstNode(), lastNode)) {
    320321                    List<Node> wayNodes = way.getNodes();
    321322                    for (int i = 0; i < wayNodes.size() - 1; i++) {
     
    326327                    break;
    327328                }
    328                 if (way.lastNode() == lastNode) {
     329                if (Objects.equals(way.lastNode(), lastNode)) {
    329330                    List<Node> wayNodes = way.getNodes();
    330331                    for (int i = wayNodes.size() - 1; i > 0; i--) {
     
    394395                if (way.isFirstLastNode(node)) continue;
    395396                for (Way wayOther: ways) {
    396                     if (way == wayOther) continue;
     397                    if (Objects.equals(way, wayOther)) continue;
    397398                    if (node.getReferrers().contains(wayOther)) return false;
    398399                }
     
    407408            for (Way w: ways) {
    408409                if (w.isClosed()) return ways.size() == 1;
    409                 if (w == currentWay) continue;
     410                if (Objects.equals(w, currentWay)) continue;
    410411                if (currentWay == null) {
    411412                    nextWay = w;
     
    414415                    break;
    415416                }
    416                 if (w.firstNode() == endNode) {
     417                if (Objects.equals(w.firstNode(), endNode)) {
    417418                    nextWay = w;
    418419                    endNode = w.lastNode();
    419420                    break;
    420421                }
    421                 if (w.lastNode() == endNode) {
     422                if (Objects.equals(w.lastNode(), endNode)) {
    422423                    nextWay = w;
    423424                    endNode = w.firstNode();
     
    428429            used += 1;
    429430            currentWay = nextWay;
    430             if (endNode == startNode) return used == ways.size();
     431            if (Objects.equals(endNode, startNode)) return used == ways.size();
    431432        }
    432433    }
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r10601 r10659  
    295295
    296296        public boolean isSuccessorOf(NodePair other) {
    297             return other.getB() == a;
     297            return Objects.equals(other.getB(), a);
    298298        }
    299299
    300300        public boolean isPredecessorOf(NodePair other) {
    301             return b == other.getA();
     301            return Objects.equals(b, other.getA());
    302302        }
    303303
     
    323323         */
    324324        public boolean contains(Node n) {
    325             return a == n || b == n;
     325            return Objects.equals(a, n) || Objects.equals(b, n);
    326326        }
    327327
     
    337337            NodePair nodePair = (NodePair) obj;
    338338            return Objects.equals(a, nodePair.a) &&
    339                     Objects.equals(b, nodePair.b);
     339                   Objects.equals(b, nodePair.b);
    340340        }
    341341    }
  • trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java

    r10467 r10659  
    1414import java.util.LinkedList;
    1515import java.util.List;
     16import java.util.Objects;
    1617import java.util.Set;
    1718
     
    243244        } else {
    244245            // Simplify segment
    245             if (simplifiedNodes.isEmpty() || simplifiedNodes.get(simplifiedNodes.size()-1) != fromN) {
     246            if (simplifiedNodes.isEmpty() || !Objects.equals(simplifiedNodes.get(simplifiedNodes.size()-1), fromN)) {
    246247                simplifiedNodes.add(fromN);
    247248            }
    248             if (fromN != toN) {
     249            if (!Objects.equals(fromN, toN)) {
    249250                simplifiedNodes.add(toN);
    250251            }
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r10601 r10659  
    1818import java.util.LinkedList;
    1919import java.util.List;
     20import java.util.Objects;
    2021import java.util.Set;
    2122import java.util.concurrent.atomic.AtomicInteger;
     
    444445
    445446        if (wayChunks.size() < 2) {
    446             if (wayChunks.get(0).get(0) == wayChunks.get(0).get(wayChunks.get(0).size() - 1)) {
     447            if (Objects.equals(wayChunks.get(0).get(0), wayChunks.get(0).get(wayChunks.get(0).size() - 1))) {
    447448                new Notification(
    448449                        tr("You must select two or more nodes to split a circular way."))
     
    569570            List<RelationMember> relationMembers = r.getMembers();
    570571            for (RelationMember rm: relationMembers) {
    571                 if (rm.isWay() && rm.getMember() == way) {
     572                if (rm.isWay() && Objects.equals(rm.getMember(), way)) {
    572573                    boolean insert = true;
    573574                    if ("restriction".equals(type) || "destination_sign".equals(type)) {
     
    630631                            if ((ir - k >= 0) && relationMembers.get(ir - k).isWay()) {
    631632                                Way w = relationMembers.get(ir - k).getWay();
    632                                 if ((w.lastNode() == way.firstNode()) || w.firstNode() == way.firstNode()) {
     633                                if (Objects.equals(w.lastNode(), way.firstNode()) || Objects.equals(w.firstNode(), way.firstNode())) {
    633634                                    backwards = Boolean.FALSE;
    634                                 } else if ((w.firstNode() == way.lastNode()) || w.lastNode() == way.lastNode()) {
     635                                } else if (Objects.equals(w.firstNode(), way.lastNode()) || Objects.equals(w.lastNode(), way.lastNode())) {
    635636                                    backwards = Boolean.TRUE;
    636637                                }
     
    639640                            if ((ir + k < relationMembers.size()) && relationMembers.get(ir + k).isWay()) {
    640641                                Way w = relationMembers.get(ir + k).getWay();
    641                                 if ((w.lastNode() == way.firstNode()) || w.firstNode() == way.firstNode()) {
     642                                if (Objects.equals(w.lastNode(), way.firstNode()) || Objects.equals(w.firstNode(), way.firstNode())) {
    642643                                    backwards = Boolean.TRUE;
    643                                 } else if ((w.firstNode() == way.lastNode()) || w.lastNode() == way.lastNode()) {
     644                                } else if (Objects.equals(w.firstNode(), way.lastNode()) || Objects.equals(w.lastNode(), way.lastNode())) {
    644645                                    backwards = Boolean.FALSE;
    645646                                }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r10467 r10659  
    2828import java.util.List;
    2929import java.util.Map;
     30import java.util.Objects;
    3031import java.util.Set;
    3132
     
    526527
    527528                // User clicked last node again, finish way
    528                 if (n0 == n) {
     529                if (Objects.equals(n0, n)) {
    529530                    finishDrawing();
    530531                    return;
     
    575576
    576577                // Add new node to way
    577                 if (way.getNode(way.getNodesCount() - 1) == n0) {
     578                if (Objects.equals(way.getNode(way.getNodesCount() - 1), n0)) {
    578579                    way.addNode(n);
    579580                } else {
     
    817818        }
    818819
    819         if (getCurrentBaseNode() == null || getCurrentBaseNode() == currentMouseNode)
     820        if (getCurrentBaseNode() == null || getCurrentBaseNode().equals(currentMouseNode))
    820821            return; // Don't create zero length way segments.
    821 
    822822
    823823        double curHdg = Math.toDegrees(getCurrentBaseNode().getEastNorth()
     
    904904    private void continueWayFromNode(Way way, Node node) {
    905905        int n = way.getNodesCount();
    906         if (node == way.firstNode()) {
     906        if (Objects.equals(node, way.firstNode())) {
    907907            currentBaseNode = node;
    908908            if (n > 1) previousNode = way.getNode(1);
    909         } else if (node == way.lastNode()) {
     909        } else if (Objects.equals(node, way.lastNode())) {
    910910            currentBaseNode = node;
    911911            if (n > 1) previousNode = way.getNode(n-2);
     
    944944            Node firstNode = w.getNode(0);
    945945            Node lastNode = w.getNode(w.getNodesCount() - 1);
    946             if ((firstNode == n || lastNode == n) && (firstNode != lastNode)) {
     946            if ((Objects.equals(firstNode, n) || Objects.equals(lastNode, n)) && !Objects.equals(firstNode, lastNode)) {
    947947                if (way != null)
    948948                    return null;
  • trunk/src/org/openstreetmap/josm/data/conflict/Conflict.java

    r9371 r10659  
    4848
    4949    public boolean isMatchingMy(OsmPrimitive my) {
    50         return this.my == my;
     50        return Objects.equals(this.my, my);
    5151    }
    5252
    5353    public boolean isMatchingTheir(OsmPrimitive their) {
    54         return this.their == their;
     54        return Objects.equals(this.their, their);
    5555    }
    5656
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java

    r10469 r10659  
    334334     */
    335335    public String getUniqueId(ImageryInfo info) {
    336         if (info.getId() != null && layerIds.get(info.getId()) == info) {
     336        if (info.getId() != null && info.equals(layerIds.get(info.getId()))) {
    337337            return info.getId();
    338338        }
  • trunk/src/org/openstreetmap/josm/gui/MapMover.java

    r10433 r10659  
    194194    @Override
    195195    public void mouseReleased(MouseEvent e) {
    196         if (e.getButton() == MouseEvent.BUTTON3 || Main.isPlatformOsx() && e.getButton() == MouseEvent.BUTTON1) {
     196        if (e.getButton() == MouseEvent.BUTTON3 || (Main.isPlatformOsx() && e.getButton() == MouseEvent.BUTTON1)) {
    197197            endMovement();
    198198        }
  • trunk/src/org/openstreetmap/josm/gui/SelectionManager.java

    r10611 r10659  
    9292        @Override
    9393        public void paint(Graphics2D g, MapView mv, Bounds bbox) {
    94             if (mousePos == null || mousePosStart == null || mousePos == mousePosStart)
     94            if (mousePos == null || mousePosStart == null || mousePos.equals(mousePosStart))
    9595                return;
    9696            Color color = Utils.complement(PaintColors.getBackgroundColor());
     
    279279
    280280    private boolean isNoSelection() {
    281         return mousePos == null || mousePosStart == null || mousePos == mousePosStart;
     281        return mousePos == null || mousePosStart == null || mousePos.equals(mousePosStart);
    282282    }
    283283
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r10657 r10659  
    692692                    int i = 1;
    693693                    for (RelationMember m : r.getMembers()) {
    694                         if (m.getMember() == primitive) {
     694                        if (primitive.equals(m.getMember())) {
    695695                            mi.add(m, i);
    696696                        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r10619 r10659  
    678678                for (int i = 0; i < tagData.getRowCount(); ++i) {
    679679                    if (item.getValue().equals(tagData.getValueAt(i, 0) /* sic! do not use getDataKey*/)) {
    680                         if (itemToSelect == item) {
     680                        if (item.equals(itemToSelect)) {
    681681                            itemToSelect = null;
    682682                        }
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r10303 r10659  
    482482                    }
    483483                    Color customColoringTransparent = hdopAlpha < 0 ? trkPnt.customColoring :
    484                         new Color(trkPnt.customColoring.getRGB() & 0x00ffffff | hdopAlpha << 24, true);
     484                        new Color((trkPnt.customColoring.getRGB() & 0x00ffffff) | (hdopAlpha << 24), true);
    485485                    g.setColor(customColoringTransparent);
    486486                    // hdop circles
     
    494494                    if (trkPnt.customColoring != null) {
    495495                        Color customColoringTransparent = largePointAlpha < 0 ? trkPnt.customColoring :
    496                             new Color(trkPnt.customColoring.getRGB() & 0x00ffffff | largePointAlpha << 24, true);
     496                            new Color((trkPnt.customColoring.getRGB() & 0x00ffffff) | (largePointAlpha << 24), true);
    497497
    498498                        g.setColor(customColoringTransparent);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

    r10657 r10659  
    513513        @Override
    514514        public boolean applies(Environment env) {
    515             return env != null && env.getCascade(env.layer) != null && not ^ env.getCascade(env.layer).containsKey(id);
     515            return env != null && env.getCascade(env.layer) != null && (not ^ env.getCascade(env.layer).containsKey(id));
    516516        }
    517517
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r10657 r10659  
    189189        }
    190190
    191         private abstract class AbstractFinder extends AbstractVisitor {
     191        private abstract static class AbstractFinder extends AbstractVisitor {
    192192            protected final Environment e;
    193193
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r10613 r10659  
    2727import java.util.List;
    2828import java.util.Map;
     29import java.util.Objects;
    2930import java.util.concurrent.ConcurrentHashMap;
    3031
     
    659660            @Override
    660661            public boolean isDataFlavorSupported(DataFlavor flavor) {
    661                 return flavors[0] == flavor;
     662                return Objects.equals(flavors[0], flavor);
    662663            }
    663664        }
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r10308 r10659  
    77import java.io.IOException;
    88import java.net.URL;
     9import java.util.Objects;
    910
    1011import javax.sound.sampled.AudioFormat;
     
    297298                            double offset = command.offset();
    298299                            speed = command.speed();
    299                             if (playingUrl != command.url() ||
     300                            if (!Objects.equals(playingUrl, command.url()) ||
    300301                                    stateChange != State.PAUSED ||
    301302                                    offset != 0) {
  • trunk/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java

    r10043 r10659  
    147147            }
    148148            for (OsmPrimitive o: rhs.getPrimitives(root)) {
    149                 if (condition == null || condition.match(o) && !result.contains(o)) {
     149                if (condition == null || (condition.match(o) && !result.contains(o))) {
    150150                    result.add(o);
    151151                }
Note: See TracChangeset for help on using the changeset viewer.