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

Initialize "primitive" type to default values

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-JSR-5
    • class generator
    • None
    • n/a

    Description

      In Java:
      class Thing {
      int a;
      int b;
      }
      Thing t = new Thing()
      t.a and t.b are both zero.

      Since Groovy uses java.lang.Integer in the above case, t.a and t.b are null.
      To avoid confusion and to be consistent with Java, uninitialized Groovy "primitive" types should be initialized to a default values consistent with Java.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            emp Edward Povazan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: