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

Documentation of BigInteger(String) constructor does not mention leading plus

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 16
    • core-libs
    • None
    • behavioral
    • minimal
    • Change the specification to match the long-standing behavior.
    • Java API
    • SE

    Description

      Summary

      Correct the BigInteger​(String val) to state its long-standing acceptance of a leading + as valid input.

      Problem

      The spec changes for JDK-5017980 omitted the update for one of the two BigInteger constructors taking a string as input.

      Solution

      Update the spec of BigInteger​(String val) to match its long-standing behavior of accepting a leading +.

      Specification

      diff -r 7a3522ab48b3 src/java.base/share/classes/java/math/BigInteger.java
      --- a/src/java.base/share/classes/java/math/BigInteger.java Wed Aug 05 23:02:22 2020 -0700
      +++ b/src/java.base/share/classes/java/math/BigInteger.java Wed Aug 05 23:18:11 2020 -0700
      @@ -659,7 +659,7 @@
      
           /**
            * Translates the decimal String representation of a BigInteger into a
      -     * BigInteger.  The String representation consists of an optional minus
      +     * BigInteger.  The String representation consists of an optional minus or plus 
            * sign followed by a sequence of one or more decimal digits.  The
            * character-to-digit mapping is provided by {@code Character.digit}.
            * The String may not contain any extraneous characters (whitespace, for

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              webbuggrp Webbug Group
              Brian Burkhalter
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: