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

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

    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

          People

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

            Dates

              Created:
              Updated:
              Resolved: