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

javadoc for getPathBounds() in TreeUI and BasicTreeUI is incorrect

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • client-libs
    • None
    • behavioral
    • minimal
    • No code change - doc only
    • Java API
    • SE

      Summary

      The javadoc description for javax.swing.plaf.TreeUI.getPathBounds() and javax.swing.plaf.basic.BasicTreeUI.getPathBounds() is misleading as it cites invalid conditions as valid

      Problem

      The javadoc descriptions for javax.swing.plaf.TreeUI.getPathBounds() and javax.swing.plaf.basic.BasicTreeUI.getPathBounds() stated the methods return null if any component in path is currently "valid".

      Solution

      The getPathBounds() in BasicTreeUI returns null if tree or treeState is null, so it should read "if any component in path is currently invalid"

      Specification

      src/java.desktop/share/classes/javax/swing/plaf/TreeUI.java

         /**
            * Returns the Rectangle enclosing the label portion that the
            * last item in path will be drawn into.  Will return null if
      -     * any component in path is currently valid.
      +     * any component in path is currently invalid.
      
      public abstract Rectangle getPathBounds(JTree tree, TreePath path);

      src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java

          /**
             * Returns the Rectangle enclosing the label portion that the
             * last item in path will be drawn into.  Will return null if
      -      * any component in path is currently valid.
      +      * any component in path is currently invalid.
             */
           public Rectangle getPathBounds(JTree tree, TreePath path) {

            psadhukhan Prasanta Sadhukhan
            ssides Steve Sides
            Alexey Ivanov, Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: