Ticket #24956: 24956-v1.patch

File 24956-v1.patch, 1.2 KB (added by mattmccutchen, 7 days ago)
  • src/org/openstreetmap/josm/data/osm/Way.java

    From Mon Sep 17 00:00:00 2001
    From: Matt McCutchen <matt@mattmccutchen.net>
    Date: Sat, 17 Oct 2026 11:10:14 -0400
    
    fix #24956 - Way "modified" flag should be based on node IDs, not coordinates
    
    Simple fix that changes Way.hasEqualSemanticAttributes to compare node
    IDs. Concerns before committing:
    
    - Does this break other use cases? Is a more complex fix needed?
    - Add a unit test so someone doesn't change the code back without being
      aware of #24956?
    ---
     src/org/openstreetmap/josm/data/osm/Way.java | 3 +--
     1 file changed, 1 insertion(+), 2 deletions(-)
    
    diff --git a/src/org/openstreetmap/josm/data/osm/Way.java b/src/org/openstreetmap/josm/data/osm/Way.java
    index 85501abef5..1238da0451 100644
    a b public final class Way extends OsmPrimitive implements IWay<Node> {  
    326326        if (getNodesCount() != w.getNodesCount()) return false;
    327327        if (!super.hasEqualSemanticAttributes(other, testInterestingTagsOnly))
    328328            return false;
    329         return IntStream.range(0, getNodesCount())
    330                 .allMatch(i -> getNode(i).hasEqualSemanticAttributes(w.getNode(i)));
     329        return Arrays.equals(nodes, w.nodes);
    331330    }
    332331
    333332    /**