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

Not so helpful error message shown by ClassNodeResolver, after eating up the real exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.6
    • 2.4.1
    • Compiler
    • None

    Description

      Attaching a zip that contains the example to reproduce the issue.

      The scenario is this: From my Ant script, I am executing a groovy script (One.groovy), which depends on another script, Two.groovy (which has a compilation error - it refers to a non-existing class FFile).

      The problem is that instead of telling me anything about FFile class's non-existence, the groovy compiler gives a not-so-useful error message that looks like below:

      ...\bug_report\build.xml:11: 
      
      BUG! exception in phase 'semantic analysis' in source unit '...\bug_report\src\One.groovy' 
      
      The lookup for Two caused a failed compilaton. There should not have been any compilation from this call.
      
              at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:188)
              at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:168)
              at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:124)
              at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:617)
              at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:269)
              at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:237)
              at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:221)
              at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:233)
              at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:988)
      ...
      ...
      

      It'll do better to include some information about the underlying exception.

      "BUG! exception in phase 'semantic analysis' in source unit '...\One.groovy'" is not much use.

      Attachments

        1. bug_report.zip
          6.06 MB
          Roshan Dawrani

        Activity

          People

            blackdrag Jochen Theodorou
            roshandawrani Roshan Dawrani
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: