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

Potentially misleading error message

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-JSR-5
    • 1.0-RC-1
    • parser
    • None
    • Ubuntu 5.10 Breezy Badger ; JDK 1.5.0_06 ; Groovy CVS HEAD

    Description

      The script:

      #! /usr/bin/env groovy

      def factorial ( x )

      { 1 }

      class Factorial_Test extends GroovyTestCase {
      void test_zero ( )

      { assertEquals ( factorial ( 0 ) , 1 ) }

      }

      results in the error message:

      Caught: BUG! exception in phase 'conversion' in source unit 'Tests/Factorial_Test.groovy' Error: duplicate class declaration for name: Factorial_Test and class: org.codehaus.groovy.ast.ClassNode@cec0c5[name: Factorial_Test]

      I understand why the message (declared class name the same as the file constructed class name) but I am not sure this is obvious to the casual Groovy user.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            russel Dr. Russel Winder
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: