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

SC: === and !== compiled to ScriptBytecodeAdapter#compareIdentical

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0.0-rc-1
    • Static compilation
    • None

    Description

      Consider the following:

      @groovy.transform.CompileStatic
      void test(ref) {
        if (ref === null) {
          //...
        }
      }
      

      The null check is written as a call to ScriptBytecodeAdapter#compareIdentical. For "ref == null" direct null-comparison bytecode is generated. There may also be opportunities for constant or reference-to-reference comparisons as well.

      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: