src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java

Print this page

        

@@ -169,29 +169,29 @@
 
     /**
      * Public property map allocator.
      *
      * <p>It is the caller's responsibility to make sure that {@code properties} does not contain
-     * properties with keys that are valid array indices.</p>
+     * properties with duplicate keys or keys that represent valid array indices.</p>
      *
      * @param properties   Collection of initial properties.
      * @param className    class name
      * @param fieldCount   Number of fields in use.
      * @param fieldMaximum Number of fields available.
      * @param spillLength  Number of used spill slots.
      * @return New {@link PropertyMap}.
      */
     public static PropertyMap newMap(final Collection<Property> properties, final String className, final int fieldCount, final int fieldMaximum,  final int spillLength) {
-        final PropertyHashMap newProperties = EMPTY_HASHMAP.immutableAdd(properties);
+        final PropertyHashMap newProperties = PropertyHashMap.create(properties);
         return new PropertyMap(newProperties, className, fieldCount, fieldMaximum, spillLength, false);
     }
 
     /**
      * Public property map allocator. Used by nasgen generated code.
      *
      * <p>It is the caller's responsibility to make sure that {@code properties} does not contain
-     * properties with keys that are valid array indices.</p>
+     * properties with duplicate keys or keys that represent valid array indices.</p>
      *
      * @param properties Collection of initial properties.
      * @return New {@link PropertyMap}.
      */
     public static PropertyMap newMap(final Collection<Property> properties) {