Hi all, Please review the fix for JDK-8217393 which updates the javadocs for Attriibutes::equals to clarify its behavior to match its implementation
————— hg diff diff -r c5d6b4480c6c src/java.base/share/classes/java/util/jar/Attributes.java --- a/src/java.base/share/classes/java/util/jar/Attributes.java Thu Jan 17 13:46:12 2019 -0800 +++ b/src/java.base/share/classes/java/util/jar/Attributes.java Sat Jan 19 07:35:55 2019 -0500 @@ -265,9 +265,10 @@ } /** - * Compares the specified Attributes object with this Map for equality. - * Returns true if the given object is also an instance of Attributes - * and the two Attributes objects represent the same mappings. + * Compares the specified object with this Map for equality. + * Returns true if the given object is also a Map + * and the two objects represent the same Manifest + * attribute name-value mappings. * * @param o the Object to be compared * @return true if the specified Object is equal to this Map ——————— Best, Lance > On Jan 17, 2019, at 6:50 PM, Lance Andersen <lance.ander...@oracle.com> wrote: > > Hi Philipp, > > I suspect the behavior dates back to the original implementation in JDK 1.2. > I am not sure it should be changed at this point though the javadocs should > be updated. > > Best > Lance >> On Jan 17, 2019, at 5:53 PM, Philipp Kunz <philipp.k...@paratix.ch> wrote: >> >> Hi, >> >> In the JavaDoc comment for java.util.jar.Attributes#equals on line 269 >> it says: >> [...] Returns true if the given object is also an instance of >> Attributes [...] >> but that is not actually true. Passing a LinkedHashMap results also in >> true returned given equal content of both maps. >> Comment and implementation don't match perfectly. But which way it >> should be? >> Could not be less important probably, so please excuse me if it's like >> spam. >> >> Philipp > > <http://oracle.com/us/design/oracle-email-sig-198324.gif> > <http://oracle.com/us/design/oracle-email-sig-198324.gif> > <http://oracle.com/us/design/oracle-email-sig-198324.gif> > <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| > Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > lance.ander...@oracle.com <mailto:lance.ander...@oracle.com> > > > <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 lance.ander...@oracle.com <mailto:lance.ander...@oracle.com>