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

@Immutable not handling property default values from map constructor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5.6, 3.0.0-beta-1
    • None
    • None

    Description

      
      import groovy.transform.Immutable
      
      @Immutable
      class Thing {
          String value = "default"
      }
      
      def thing = new Thing()
      assert thing.value == "default"
      

      Gives:

      Assertion failed: 
      
      assert thing.value == "default"
             |     |     |
             |     null  false
             Thing(null)
      

      Attachments

        Activity

          People

            paulk Paul King
            paulk Paul King
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: