8011540: PropertyMap histories should not begin with empty map
authorjlaskey
Thu, 04 Apr 2013 09:05:38 -0300
changeset 16774 745fe7d2536d
parent 16764 fcf1b6c58970
child 16775 a19a1107f33e
8011540: PropertyMap histories should not begin with empty map Reviewed-by: lagergren, sundar Contributed-by: james.laskey@oracle.com
nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Tue Apr 02 11:38:04 2013 -0300
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Apr 04 09:05:38 2013 -0300
@@ -540,11 +540,13 @@
      * @param newMap   Modified {@link PropertyMap}.
      */
     private void addToHistory(final Property property, final PropertyMap newMap) {
-        if (history == null) {
-            history = new LinkedHashMap<>();
+        if (!properties.isEmpty()) {
+            if (history == null) {
+                history = new LinkedHashMap<>();
+            }
+
+            history.put(property, newMap);
         }
-
-        history.put(property, newMap);
     }
 
     /**