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

Default values for primitives error in groovy 1.8.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.0
    • 1.8.1
    • primtive opts
    • None

    Description

      In Groovy 1.8.0, this works fine:

      groovy:000>  int x; println x
      0
      ===>  null
      

      Whereas this blows up:

      groovy:000>  int x; 1.times { println x }
      ERROR org.codehaus.groovy.runtime.typehandling.GroovyCastException:
      Cannot cast object 'null' with class 'null' to class 'int'. Try
      'java.lang.Integer' instead
              at groovysh_evaluate.run (groovysh_evaluate:2)
              ...
      

      Is that a known issue?

      bug and not known, because new in 1.8. Please fill a bug report for this

      bye blackdrag

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            shogusumi Ben Houston
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: