Index: /trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java	(revision 13717)
@@ -140,6 +140,6 @@
         if (osm instanceof INode) {
             return format((INode) osm);
-        } else if (osm instanceof IWay) {
-            return format((IWay) osm);
+        } else if (osm instanceof IWay<?>) {
+            return format((IWay<?>) osm);
         } else if (osm instanceof IRelation) {
             return format((IRelation) osm);
@@ -214,5 +214,5 @@
 
     @Override
-    public String format(IWay way) {
+    public String format(IWay<?> way) {
         StringBuilder name = new StringBuilder();
 
@@ -298,8 +298,8 @@
     }
 
-    private final Comparator<IWay> wayComparator = (w1, w2) -> format(w1).compareTo(format(w2));
-
-    @Override
-    public Comparator<IWay> getWayComparator() {
+    private final Comparator<IWay<?>> wayComparator = (w1, w2) -> format(w1).compareTo(format(w2));
+
+    @Override
+    public Comparator<IWay<?>> getWayComparator() {
         return wayComparator;
     }
Index: /trunk/src/org/openstreetmap/josm/data/osm/IWay.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/IWay.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/IWay.java	(revision 13717)
@@ -2,9 +2,12 @@
 package org.openstreetmap.josm.data.osm;
 
+import java.util.List;
+
 /**
  * IWay captures the common functions of {@link Way} and {@link WayData}.
+ * @param <N> type of OSM node
  * @since 4098
  */
-public interface IWay extends IPrimitive {
+public interface IWay<N extends INode> extends IPrimitive {
 
     /**
@@ -31,4 +34,31 @@
 
     /**
+     * Replies the node at position <code>index</code>.
+     *
+     * @param index the position
+     * @return  the node at position <code>index</code>
+     * @throws ArrayIndexOutOfBoundsException if <code>index</code> &lt; 0
+     * or <code>index</code> &gt;= {@link #getNodesCount()}
+     * @since 1862
+     * @since 13717 (IWay)
+     */
+    N getNode(int index);
+
+    /**
+     * Returns the list of nodes in this way.
+     * @return the list of nodes in this way
+     * @since 1862
+     * @since 13717 (IWay)
+     */
+    List<N> getNodes();
+
+    /**
+     * Returns the list of node ids in this way.
+     * @return the list of node ids in this way
+     * @since 13717
+     */
+    List<Long> getNodeIds();
+
+    /**
      * Returns id of the node at given index.
      * @param idx node index
@@ -47,5 +77,5 @@
         if (o instanceof IRelation)
             return 1;
-        return o instanceof IWay ? Long.compare(getUniqueId(), o.getUniqueId()) : -1;
+        return o instanceof IWay<?> ? Long.compare(getUniqueId(), o.getUniqueId()) : -1;
     }
 
Index: /trunk/src/org/openstreetmap/josm/data/osm/NameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/NameFormatter.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/NameFormatter.java	(revision 13717)
@@ -26,5 +26,5 @@
      * @since 13564 (signature)
      */
-    String format(IWay way);
+    String format(IWay<?> way);
 
     /**
@@ -57,5 +57,5 @@
      * @since 13564 (signature)
      */
-    Comparator<IWay> getWayComparator();
+    Comparator<IWay<?>> getWayComparator();
 
     /**
Index: /trunk/src/org/openstreetmap/josm/data/osm/NameFormatterHook.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/NameFormatterHook.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/NameFormatterHook.java	(revision 13717)
@@ -31,5 +31,5 @@
      * @return The corrected format if needed, null otherwise.
      */
-    String checkFormat(IWay way, String defaultName);
+    String checkFormat(IWay<?> way, String defaultName);
 
     /**
Index: /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java	(revision 13717)
@@ -86,5 +86,5 @@
     public static OsmPrimitiveType from(IPrimitive obj) {
         if (obj instanceof INode) return NODE;
-        if (obj instanceof IWay) return WAY;
+        if (obj instanceof IWay<?>) return WAY;
         if (obj instanceof IRelation) return RELATION;
         throw new IllegalArgumentException("Unknown type: "+obj);
Index: /trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 13717)
@@ -10,4 +10,5 @@
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -26,20 +27,13 @@
  * @since 64
  */
-public final class Way extends OsmPrimitive implements IWay {
+public final class Way extends OsmPrimitive implements IWay<Node> {
 
     /**
      * All way nodes in this way
-     *
      */
     private Node[] nodes = new Node[0];
     private BBox bbox;
 
-    /**
-     *
-     * You can modify returned list but changes will not be propagated back
-     * to the Way. Use {@link #setNodes(List)} to update this way
-     * @return Nodes composing the way
-     * @since 1862
-     */
+    @Override
     public List<Node> getNodes() {
         return new CopyList<>(nodes);
@@ -105,13 +99,5 @@
     }
 
-    /**
-     * Replies the node at position <code>index</code>.
-     *
-     * @param index the position
-     * @return  the node at position <code>index</code>
-     * @throws ArrayIndexOutOfBoundsException if <code>index</code> &lt; 0
-     * or <code>index</code> &gt;= {@link #getNodesCount()}
-     * @since 1862
-     */
+    @Override
     public Node getNode(int index) {
         return nodes[index];
@@ -121,4 +107,9 @@
     public long getNodeId(int idx) {
         return nodes[idx].getUniqueId();
+    }
+
+    @Override
+    public List<Long> getNodeIds() {
+        return Arrays.stream(nodes).map(Node::getId).collect(Collectors.toList());
     }
 
@@ -277,5 +268,5 @@
 
             List<Node> newNodes = new ArrayList<>(wayData.getNodes().size());
-            for (Long nodeId : wayData.getNodes()) {
+            for (Long nodeId : wayData.getNodeIds()) {
                 Node node = (Node) getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE);
                 if (node != null) {
@@ -296,5 +287,5 @@
         saveCommonAttributes(data);
         for (Node node:nodes) {
-            data.getNodes().add(node.getUniqueId());
+            data.getNodeIds().add(node.getUniqueId());
         }
         return data;
Index: /trunk/src/org/openstreetmap/josm/data/osm/WayData.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/WayData.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/WayData.java	(revision 13717)
@@ -10,5 +10,5 @@
  * The data (tags and node ids) that is stored for a way in the database
  */
-public class WayData extends PrimitiveData implements IWay {
+public class WayData extends PrimitiveData implements IWay<NodeData> {
 
     private static final long serialVersionUID = 106944939313286415L;
@@ -37,12 +37,19 @@
     public WayData(WayData data) {
         super(data);
-        nodes.addAll(data.getNodes());
+        nodes.addAll(data.getNodeIds());
     }
 
-    /**
-     * Gets a list of nodes the way consists of
-     * @return The ids of the nodes
-     */
-    public List<Long> getNodes() {
+    @Override
+    public List<NodeData> getNodes() {
+        throw new UnsupportedOperationException("Use getNodeIds() instead");
+    }
+
+    @Override
+    public NodeData getNode(int index) {
+        throw new UnsupportedOperationException("Use getNodeId(int) instead");
+    }
+
+    @Override
+    public List<Long> getNodeIds() {
         return nodes;
     }
Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/PrimitiveVisitor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/PrimitiveVisitor.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/PrimitiveVisitor.java	(revision 13717)
@@ -22,5 +22,5 @@
      * @param w The way to inspect.
      */
-    void visit(IWay w);
+    void visit(IWay<?> w);
 
     /**
Index: /trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java	(revision 13717)
@@ -126,5 +126,5 @@
     private static void updateNodes(Map<Long, Long> newNodeIds, PrimitiveData data) {
         List<Long> newNodes = new ArrayList<>();
-        for (Long oldNodeId : ((WayData) data).getNodes()) {
+        for (Long oldNodeId : ((WayData) data).getNodeIds()) {
             Long newNodeId = newNodeIds.get(oldNodeId);
             if (newNodeId != null) {
Index: /trunk/src/org/openstreetmap/josm/io/OsmWriter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmWriter.java	(revision 13716)
+++ /trunk/src/org/openstreetmap/josm/io/OsmWriter.java	(revision 13717)
@@ -19,5 +19,4 @@
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DownloadPolicy;
-import org.openstreetmap.josm.data.osm.UploadPolicy;
 import org.openstreetmap.josm.data.osm.INode;
 import org.openstreetmap.josm.data.osm.IPrimitive;
@@ -28,4 +27,5 @@
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Tagged;
+import org.openstreetmap.josm.data.osm.UploadPolicy;
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
@@ -229,4 +229,8 @@
     }
 
+    /**
+     * Writes data sources with their respective bounds.
+     * @param ds data set
+     */
     public void writeDataSources(DataSet ds) {
         for (DataSource s : ds.getDataSources()) {
@@ -263,5 +267,5 @@
 
     @Override
-    public void visit(IWay w) {
+    public void visit(IWay<?> w) {
         if (w.isIncomplete()) return;
         addCommon(w, "way");
@@ -295,4 +299,8 @@
     }
 
+    /**
+     * Visiting call for changesets.
+     * @param cs changeset
+     */
     public void visit(Changeset cs) {
         out.print("  <changeset id='"+cs.getId()+'\'');
