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

NullObject leak

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.13
    • Compiler
    • None

    Description

      def b = null  
      assert b == null  
      def a = null.getClass().newInstance()  
      println a.getClass() 
      assert a == null
      

      The program shows a leak of NullObject. newInstance will give an instance. This is problematic in multiple ways. NullObject is supposed to be almost an invisible object, as well as a singleton.
      To make the program above pass we could either fix the compareEquals or we fix newInstance() to return null for NullObject. I prefer the later one.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              blackdrag Jochen Theodorou
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: