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

SC: <=> compiled to ScriptBytecodeAdapter#compareTo for primitives

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

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-rc-2
    • Static compilation
    • None

    Description

      Consider the following:

      @groovy.transform.CompileStatic
      int cmp(int a, int b) {
        a <=> b
      }
      

      "a <=> b" for primitive types is not optimized to make use of Integer#compare or similar – instead it is transformed into ScriptBytecodeAdapter.compareTo(a,b)

      Attachments

        Activity

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

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment