Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8763

CharSequence.toInteger() only deals with base 10 integer literals

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.5.2
    • Fix Version/s: None
    • Component/s: groovy-jdk
    • Labels:
      None

      Description

      {{'0644'.toInteger() }}resolves to 644 (base 10)

      {{'0x123'.toInteger() }}fails with an exception

      The groovy JDK docs for the method state "Parse a CharSequence into an Integer"

       

      Either the docs should be updated, stating explicitly the parsing happens in base 10, or the method should be altered to accept the various non-base 10 integer literal notations.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              PhRX Philip Arickx
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: