8011540: PropertyMap histories should not begin with empty map
Reviewed-by: lagergren, sundar
Contributed-by: james.laskey@oracle.com
--- 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);
}
/**