Index: trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 8580)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 8581)
@@ -31,5 +31,4 @@
  *
  */
-@SuppressWarnings("serial")
 public class TagEditorModel extends AbstractTableModel {
     public static final String PROP_DIRTY = TagEditorModel.class.getName() + ".dirty";
@@ -407,7 +406,5 @@
      */
     public void applyToPrimitive(Tagged primitive) {
-        Map<String, String> tags = primitive.getKeys();
-        applyToTags(tags, false);
-        primitive.setKeys(tags);
+        primitive.setKeys(applyToTags(false));
     }
 
@@ -415,9 +412,8 @@
      * applies the current state of the tag editor model to a map of tags
      *
-     * @param tags the map of key/value pairs
-     *
-     */
-    public void applyToTags(Map<String, String> tags, boolean keepEmpty) {
-        tags.clear();
+     * @return the map of key/value pairs
+     */
+    private Map<String, String> applyToTags(boolean keepEmpty) {
+        Map<String, String> result = new HashMap<>();
         for (TagModel tag: this.tags) {
             // tag still holds an unchanged list of different values for the same key.
@@ -432,6 +428,7 @@
                 continue;
             }
-            tags.put(tag.getName().trim(), tag.getValue().trim());
-        }
+            result.put(tag.getName().trim(), tag.getValue().trim());
+        }
+        return result;
     }
 
@@ -441,7 +438,5 @@
 
     public Map<String, String> getTags(boolean keepEmpty) {
-        Map<String, String> tags = new HashMap<>();
-        applyToTags(tags, keepEmpty);
-        return tags;
+        return applyToTags(keepEmpty);
     }
 
