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

Chained null-safe navigation is broken in CompileStatic mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.2
    • 2.1.3
    • Static Type Checker
    • None

    Description

      Chained elvis is broken in CompileStatic mode. Here's an example that reproduces the problem:

      @groovy.transform.CompileStatic
      def elvisNPE() {
          Map<String, Map<String,Integer>> m=[:]
          // this is ok
          println m?.a 
          // throws NPE   
          println m?.a?.b
      }
      elvisNPE()
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            lhotari Lari Hotari
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: