Hi,
I was working on upgrading a library of mine from Java 8 to 11, and I
noticed my unit tests started failing. Some investigation showed that in
Java 9, java.util.Properties was rewritten to no longer rely on the fact
that it extends Hashtable. One of the changes was to use a private
static class called EntrySet. However, while this class implements most
methods from java.util.Set, it's actually missing two: equals and
hashCode. As a result it does not adhere to the general contract of
java.util.Set. It's also missing a toString implementation, thereby
inheriting its String representation from java.lang.Object. I've checked
the source code up to Java 14, and even the Mercurial repository, and
this issue still exists.
I think this could be solved as simply as by having this private
EntrySet class extend AbstractSet, or otherwise delegate its methods to
its entrySet field. The latter is probably preferred, as it matches the
implementation of the same methods of the java.util.Properties class itself.
Rob
- [BUG] java.util.Properties.entrySet() does not override java.l... Rob Spoor
-