# HG changeset patch # User smarks # Date 1464814075 25200 # Node ID 545bcf25bef0cf625d873eb90076f89bd6cc1eda # Parent fdbc4de9dfc9a4cc34a355178e11c9cbefaa0ce7 8059361: Properties.stringPropertyNames() returns a set inconsistent with the assertions from the spec Reviewed-by: mchung diff -r fdbc4de9dfc9 -r 545bcf25bef0 jdk/src/java.base/share/classes/java/util/Properties.java --- a/jdk/src/java.base/share/classes/java/util/Properties.java Wed Jun 01 11:22:06 2016 -0700 +++ b/jdk/src/java.base/share/classes/java/util/Properties.java Wed Jun 01 13:47:55 2016 -0700 @@ -1037,18 +1037,18 @@ } /** - * Returns a set of keys in this property list where - * the key and its corresponding value are strings, + * Returns an unmodifiable set of keys from this property list + * where the key and its corresponding value are strings, * including distinct keys in the default property list if a key * of the same name has not already been found from the main * properties list. Properties whose key or value is not * of type {@code String} are omitted. *

- * The returned set is not backed by the {@code Properties} object. - * Changes to this {@code Properties} are not reflected in the set, - * or vice versa. + * The returned set is not backed by this {@code Properties} object. + * Changes to this {@code Properties} object are not reflected in the + * returned set. * - * @return a set of keys in this property list where + * @return an unmodifiable set of keys in this property list where * the key and its corresponding value are strings, * including the keys in the default property list. * @see java.util.Properties#defaults @@ -1057,7 +1057,7 @@ public Set stringPropertyNames() { Map h = new HashMap<>(); enumerateStringProperties(h); - return h.keySet(); + return Collections.unmodifiableSet(h.keySet()); } /**