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

Parsing a class from a script that has a CNFE in it produces no errors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.0-RC-1
    • 1.0
    • parser
    • None

    Description

      Given the following script:

      gcl = new GroovyClassLoader()

      try {
      def clazz = gcl.parseClass(new File("Test.groovy"))
      }
      catch(RuntimeException e) {
      println e.message
      e.printStackTrace(System.out)
      }

      And the following class:

      class TestClass {
      Test(SomeClass someClass)

      { this.someClass = someClass }

      }

      The exception that is thrown contains no information about the cause of the problem:

      startup failed,
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed,
      at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:326)
      at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:173)
      at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:143)
      at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:155)
      at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:382)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:87)
      at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:279)
      at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:184)
      at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:833)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)

      Even if you try iterative over ErrorCollector there is nothing to tell you that the reason the exception was thrown is that SomeClass.class does not exist

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            graemerocher Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: