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

groovsh import of non existing class throws null pointer instead of syntax error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.3, 2.5.12
    • 2.5.14, 3.0.7, 4.0.0-alpha-2
    • Groovysh
    • None

    Description

      in groovy sh, when you import class that doesn't exist, the error you see is NullPointer instead of class not found.

      I tracked the problem to ImportCommand class

       

      catch (CompilationFailedException e) {
          def msg = "Invalid import definition: '${importSpec}'; reason: $e.message" // TODO: i18n
          log.debug(msg, e)
          fail(msg)
      }
      finally {
          // Remove the class generated while testing the import syntax
          classLoader.removeClassCacheEntry(type?.name) <-- null is passed to remove call inside
      }
       
      

      I don't know the process, but I wouldn't mind to create PR

      Attachments

        Activity

          People

            paulk Paul King
            ninside Mykola Golubyev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: