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

java.math.BigInteger.compareTo(Object o) spec error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: docs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      Name: ksC84122 Date: 04/07/99


      The javadoc for java.math.BigInteger.compareTo(Object o) says:
      -----
      Compares this BigInteger with the specified Object. If the Object is a
           BigInteger, this method behaves like compareTo(BigInteger). Otherwise, it
           throws a ClassCastException (as BigIntegers are comparable only to other
           BigIntegers).
      .....
      Returns:
               a negative number, zero, or a positive number as this BigInteger is
               numerically less than, equal to, or greater than o, which must be a
               BigInteger.
      -----
      According to the javadoc, this method should "behave like compareTo(BigInteger)" if
      argument is a BigInteger. It means that it should return exactly -1, 0 or 1 as
      indicated in the javadoc for compareTo(BigInteger).
      However, the javadoc states that compareTo(Object o) returns some "negative number",
      zero or some "positive number". This contradicts the statement that "this method behaves like
      compareTo(BigInteger)".
           
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            shommel Scott Hommel (Inactive)
            Reporter:
            skosunw Sko Sko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: