Changeset 17357 in josm
- Timestamp:
- 2020-11-25T11:45:20+01:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r16553 r17357 194 194 195 195 /** 196 * Constructs an identical clone of the argument. 196 * Constructs an identical clone of the argument and links members to it. 197 * See #19885 for possible memory leaks. 197 198 * @param clone The relation to clone 198 199 * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. … … 210 211 211 212 /** 212 * Constructs an identical clone of the argument. 213 * Constructs an identical clone of the argument and links members to it. 214 * See #19885 for possible memory leaks. 213 215 * @param clone The relation to clone 214 216 * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. … … 220 222 221 223 /** 222 * Create an identical clone of the argument (including the id) 224 * Create an identical clone of the argument (including the id) and links members to it. 225 * See #19885 for possible memory leaks. 223 226 * @param clone The relation to clone, including its id 224 227 */ -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r17103 r17357 31 31 32 32 static final UniqueIdGenerator idGenerator = new UniqueIdGenerator(); 33 private static final Node[] EMPTY_NODES = new Node[0]; 33 34 34 35 /** 35 36 * All way nodes in this way 36 37 */ 37 private Node[] nodes = new Node[0];38 private Node[] nodes = EMPTY_NODES; 38 39 private BBox bbox; 39 40 … … 53 54 } 54 55 55 if (nodes == null) { 56 this.nodes = new Node[0];56 if (nodes == null || nodes.isEmpty()) { 57 this.nodes = EMPTY_NODES; 57 58 } else { 58 this.nodes = nodes.toArray( new Node[0]);59 this.nodes = nodes.toArray(EMPTY_NODES); 59 60 } 60 61 for (Node node: this.nodes) { … … 196 197 /** 197 198 * Constructs a new {@code Way} from an existing {@code Way}. 199 * This adds links from all way nodes to the clone. See #19885 for possible memory leaks. 198 200 * @param original The original {@code Way} to be identically cloned. Must not be null 199 201 * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. … … 212 214 /** 213 215 * Constructs a new {@code Way} from an existing {@code Way}. 216 * This adds links from all way nodes to the clone. See #19885 for possible memory leaks. 214 217 * @param original The original {@code Way} to be identically cloned. Must not be null 215 218 * @param clearMetadata If {@code true}, clears the OSM id and other metadata as defined by {@link #clearOsmMetadata}. … … 223 226 /** 224 227 * Constructs a new {@code Way} from an existing {@code Way} (including its id). 228 * This adds links from all way nodes to the clone. See #19885 for possible memory leaks. 225 229 * @param original The original {@code Way} to be identically cloned. Must not be null 226 230 * @since 86
Note:
See TracChangeset
for help on using the changeset viewer.