Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4225933

The javax.swing.text.StyleContext.SmallAttributeSet equals() javadoc is wrong

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.5.1



      Name: akC57697 Date: 04/01/99



       The javadoc:
      "
      public boolean equals(Object obj)

           Compares this object to the specifed object. The result is true if and only if the
           argument is not null and is a Font object with the same name, style, and point
           size as this font. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^^^^^^^^^^
           Overrides:
               equals in class Object
           Parameters:
               obj - the object to compare this font with.
           Returns:
               true if the objects are equal; false otherwise.
      "
      But the javadoc contradicts the code
      (line 816 of StyleContext.java 1.57 98/11/17)

              public boolean equals(Object obj) {
                  if (obj instanceof AttributeSet) {
                      AttributeSet attrs = (AttributeSet) obj;
                      return ((getAttributeCount() == attrs.getAttributeCount()) &&
                              containsAttributes(attrs));
                  }
                  return false;
              }

      It seems the javadoc comment was accidently copied from
      FontKey.equals()


      ======================================================================

            tprinzing Tim Prinzing (Inactive)
            akuzminorcl Alexander Kuzmin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: