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

General error during class generation: Should not be called.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-JSR-2
    • class generator
    • None
    • Intel Linux
      java version "1.4.1_05"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_05-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_05-b01, mixed mode)

    Description

      The enclosed file generates the following errors. The script testg is attached as well.

      108 1:01pm mhusby@gallium ~/groovy/tasklist/src/groovy/name/erikhusby/tasklist > testg TasksTest.groovy
      Compiling: TasksTest.groovy
      General error during class generation: Should not be called

      at org.codehaus.groovy.control.ProcessingUnit.fail(ProcessingUnit.java:466)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:939)
      at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:586)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:228)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:154)
      at groovy.util.GroovyTestSuite.compile(GroovyTestSuite.java:103)
      at groovy.util.GroovyTestSuite.loadTestSuite(GroovyTestSuite.java:98)
      at groovy.util.GroovyTestSuite.suite(GroovyTestSuite.java:83)
      at groovy.util.GroovyTestSuite.main(GroovyTestSuite.java:77)
      Exception in thread "main" java.lang.RuntimeException: Could not create the test suite:
      at groovy.util.GroovyTestSuite.suite(GroovyTestSuite.java:87)
      at groovy.util.GroovyTestSuite.main(GroovyTestSuite.java:77)
      Caused by:
      at org.codehaus.groovy.control.ProcessingUnit.fail(ProcessingUnit.java:466)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:939)
      at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:586)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:228)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:154)
      at groovy.util.GroovyTestSuite.compile(GroovyTestSuite.java:103)
      at groovy.util.GroovyTestSuite.loadTestSuite(GroovyTestSuite.java:98)
      at groovy.util.GroovyTestSuite.suite(GroovyTestSuite.java:83)
      ... 1 more

      ----- TasksTest.groovy
      import groovy.util.XmlParser;
      class TasksTest extends GroovyTestCase {
      tasksXml = <<<EOD
      <tasks>
      <task priority="1">
      <description>Task 1</description>
      <notes>Notes 1</notes>
      </task>
      <task priority="2" completed="true">
      <description>Task 2</description>
      </task>
      <task>
      <notes>NO priority or other attributes</notes>
      </task>
      </tasks>
      EOD

      void testCountNodes()

      { tasks = new XmlParser().parseText(tasksXml); println tasks.children().size(); assert tasks.children().size() == 3 ; }

      getDescription(aTask)

      { return (aTask.description[0] == null) ? "" : aTask.description[0]->text(); }

      dumpTask(aTask) {
      println aTask.class;
      println "Priority: ${aTask.attributes().priority}";
      println "Completed: ${aTask.attributes().completed}";
      println "Description: ${getDescription(aTask)}";
      println "Notes: ${aTask.notes[0]->text()}";
      }

      void testFindTask() {
      tasks = new XmlParser().parseText(tasksXml);
      task = tasks.task.find

      {it['@priority'] == "2" }

      ;
      assert task.attributes().priority == "2";
      assert task.attributes().completed;
      assert task.description[0]-->text() == "Task 2";
      }

      void testWalkTasks() {
      tasks = new XmlParser().parseText(tasksXml);
      tasks.task.each()

      { dumpTask(it)}

      ;
      }
      }

      ----- testg
      #!/bin/csh
      #

      1. Runs a Groovy TestCase
      2. Expects javag to be in our path.
      3. Expects GROOVY_HOME to be set

      if($#argv == 0) then
      echo "Usage: $0 [[-cp path] [-lib path]] class"
      exit 1
      endif

      javag groovy.util.GroovyTestSuite $*

      ----- javag
      #!/bin/csh
      #

      1. Runs a Groovy java program.
      2. Expects GROOVY_HOME to be set

      if($#argv == 0) then
      echo "Usage: $0 [[-cp path] [-lib path]] class"
      exit 1
      endif

      1. OS Specific support
        @ cygwin=0
        @ darwin=0
        switch ("`uname`")
        case CYGWIN*:
        @ cygwin=1
        breaksw
        case Darwin*:
        @ darwin=1
        breaksw
        endsw
      1. Locate a JVM
        if ( ! $?JAVACMD ) then
        if ( $?JAVA_HOME ) then
        if ( -x "$JAVA_HOME/jre/sh/java" ) then
      2. IBM's JDK on AIX uses strange locations for the executables
        set JAVACMD="$JAVA_HOME/jre/sh/java"
        else
        set JAVACMD="$JAVA_HOME/bin/java"
        endif
        else
        set JAVACMD=java
        endif
        endif

      if ( ! $?JAVACMD ) then
      echo "Error: JAVA_HOME is not defined correctly."
      echo " We cannot execute $JAVACMD"
      exit 1
      endif

      if ( ! $?GROOVY_HOME) then
      echo "Error: GROOVY_HOME is not defined correctly."
      exit 1
      endif

      #

      1. Add in all the Groovy jars
        set groovyLib = $GROOVY_HOME
        if ( $cygwin ) then
        set groovyLib = `cygpath -u "$GROOVY_HOME"`
        endif

      set localclasspath=""
      foreach jarfile ($groovyLib/lib/*.jar)
      set localclasspath="$localclasspath":"$jarfile"
      end

      set clazz=""

      1. Parse the options
        while($#argv)
        if("$argv[1]" == "-cp") then
        shift
        set cp = $argv[1]
        if($cygwin) then
        set cp = `cygpath -u "$cp"`
        endif
        if ($?localclasspath) then
        set localclasspath="$localclasspath":"$cp"
        else
        set localclasspath=$cp
        endif

      else if("$argv[1]" == "-lib") then
      shift
      set lib=$argv[1]
      if($cygwin) then
      set lib = `cygpath -u "$lib"`
      endif
      foreach jarfile ($lib/*.jar)
      set localclasspath = "$localclasspath":"$jarfile"
      end
      else
      set clazz="$clazz $argv[1]"
      endif
      shift
      end
      #
      if($cygwin) then
      set localclasspath=`cygpath -w -p "$localclasspath"`
      endif

      #echo $JAVACMD -classpath $localclasspath $clazz
      $JAVACMD -classpath $localclasspath $clazz

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            erikhusby Erik Husby
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: