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

primitive type casting doesn't work

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-beta-6
    • None
    • None

    Description

      1> d = 1.234.doubleValue()
      2> x = (Integer) d
      3> y = (int) d
      4> assert x.class == Integer.class
      5> assert y.class != Double.class : y.class
      6> go
      >>> a serious error occurred: class java.lang.Double. Expression: (y.class != java.lang.Double.class)
      >>> stacktrace:
      java.lang.AssertionError: class java.lang.Double. Expression: (y.class != java.lang.Double.class)

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            bingran Bing Ran
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment