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

spec for java.awt.List.add(String item, int index) is wrong

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: docs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description



      Name: dsC58869 Date: 06/18/98



      The JLS for java.awt.List.add(String item, int index) constructor is wrong.
      It says:
          /**
           * Adds the specified item to the end of the scrolling list.
             !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
           * The index is zero-based. If value of the index is
           * <code>-1</code> then the item is added to the end.
           * If value of the index is greater than the number of
           * items in the list, the item is added at the end.
           * @param item the item to be added.
           * @param index the position at which to add the item.
           * @since JDK1.1
           */
          public synchronized void add(String item, int index) {
       
      But the method adds item at the index position.

      Besides, the docs does not say about index less than -1.
      In this case method adds item to the end of list.

      ======================================================================
       Justification:
      Wrong specification, should be fixed for JCK testing.

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kwalrathsunw Kathy Walrath (Inactive)
                Reporter:
                dsilaev Dmitri Silaev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: