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

NullObject paradoxes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.5, 1.8-beta-2
    • 1.8.0
    • groovy-runtime
    • None

    Description

      def theNull = NullObject.getNullObject()
      
      assert theNull 	//	first paradox
      
      assert theNull instanceof NullObject
      assert theNull.equals(null)
      assert theNull != null	//	second paradox
      
      assert null.getClass() == NullObject
      assert !(null instanceof NullObject)	//	third paradox
      

      I have bumped into this paradox after debugging the following script:

      new File('inexestent-folder/').listFiles().with { files ->
      	assert files
      	assert files in NullObject
      
      	println "This shouldn't happen"
      }
      

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              mojojojo Nikita Y Volkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: