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

Unboxing a Boolean generates an NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-4
    • 1.0-RC-1
    • None
    • None

    Description

      def boolean b(() {}

      if (!b()) prinln "OK"

      this generates an NPE. We should treat null as false in this context

      The source of this appears to be in the implementation of "as"

      null as boolean and null as Boolean return null I think that they should return false.

      This is a rather subtle point - i will post a message on dev so that we can discuss this before I try to fix it.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            tug John Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: