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

@Immutable not handling property default values from map constructor

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.6, 3.0.0-beta-1
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: