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

"as" does not convert strings to integer types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.6, 1.6-beta-1
    • 1.5.7, 1.6-beta-2
    • groovy-jdk
    • None

    Description

      The following does not work in Groovy, but it should:

      def n = "2345"
      assert (n as Integer) == 2345
      

      The above code currently throws a ClassCastException.

      Attachments

        1. AsTest.groovy
          1 kB
          Peter Ledbrook
        2. GROOVY-2928.patch
          0.9 kB
          Peter Ledbrook

        Activity

          People

            paulk Paul King
            pledbrook Peter Ledbrook
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: