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

error running groovyc from ant

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-4
    • 1.0-JSR-6
    • class generator
    • None

    Description

      Our groovy project compiles on JSR-03 and fails to compile on JSR-04. Below are the details.

      GROOVY-1.0-JSR-03
      -----------------------------------------------
      environment:

      • no groovy files in the ANT_HOME/lib
      • no groovy jars on the default classpath
      • all files groovy-1.0-jsr-03/lib reside in project ${dir.lib}

      excerpts from ant file:
      <path id="project.classpath">
      <!-- include the classes in this project -->
      <pathelement location="${dir.build}"/>
      <pathelement location="${dir.src}"/>
      <!-- include external libraries -->
      <fileset dir="${dir.lib}" includes="*/.jar"/>
      </path>

      <taskdef name="groovyc" classpathref="project.classpath" classname="org.codehaus.groovy.ant.Groovyc">

      <java classname="org.codehaus.groovy.ant.Groovyc" fork="yes" maxmemory="512m">
      <classpath refid="project.classpath"/>
      <arg value="${dir.build}"/>
      <arg value="${dir.src}"/>
      </java>

      <groovyc destdir="${dir.build}" srcdir="${dir.src}" classpathref="project.classpath" stacktrace="true"/>

      With JSR-03, Everything compiles successfully running Groovyc from a java task.

      With JSR-03, compiling our groovy scripts with the task groovyc fails with the following error:

      BUILD FAILED
      C:\gsapworkspace\GAP_RATING\build.xml:72: General error during class generation: No such class: [Lcom.mutualofomaha.gsa.gap.rating.data.AgeSlopeBean; in cast for class: com.mutualofomaha.gsa.gap.rating.calc.ltd.LtdRateCalc. At [256:21] C:\gsapworkspace\GAP_RATING\src\com\mutualofomaha\gsa\gap\rating\calc\ltd\LtdRateCalc.groovy

      groovy.lang.MissingClassException: No such class: [Lcom.mutualofomaha.gsa.gap.rating.data.AgeSlopeBean; in cast for class: com.mutualofomaha.gsa.gap.rating.calc.ltd.LtdRateCalc. At [256:21] C:\gsapworkspace\GAP_RATING\src\com\mutualofomaha\gsa\gap\rating\calc\ltd\LtdRateCalc.groovy
      at org.codehaus.groovy.classgen.AsmClassGenerator.checkValidType(AsmClassGenerator.java:4837)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitCastExpression(AsmClassGenerator.java:1885)
      at org.codehaus.groovy.ast.expr.CastExpression.visit(CastExpression.java:97)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:4273)
      at org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmClassGenerator.java:4117)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:1154)
      at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:343)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:4273)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:1140)
      at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:70)
      at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:83)
      at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:79)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:401)
      at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:808)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:297)
      at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:610)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:840)
      at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:556)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:461)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:423)
      at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:471)
      at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:376)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at org.apache.tools.ant.Task.perform(Task.java:364)
      at org.apache.tools.ant.Target.execute(Target.java:341)
      at org.apache.tools.ant.Target.performTasks(Target.java:369)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

      1 Error

      JSR-04
      ----------------------------------------------------------------------

      • deleted all groovy files out of our project lib
      • replaced all groovy jars in our project lib directory with the jars in groovy-1.0-jsr-04/lib
      • delete SNAPSHOT
      • made sure there weren't any duplicate asm*.jars

      Build fails with the following trying to run Groovyc as an ant java task:
      [java] null

      [java] at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:480)
      [java] at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:376)
      [java] at org.codehaus.groovy.ant.Groovyc.main(Groovyc.java:131)
      [java] Caused by: java.lang.NullPointerException
      [java] at org.objectweb.asm.Type.getInternalName(Unknown Source)
      [java] at org.codehaus.groovy.classgen.BytecodeHelper.getClassInternalName(BytecodeHelper.java:227)
      [java] at org.codehaus.groovy.classgen.BytecodeHelper.getClassInternalName(BytecodeHelper.java:223)
      [java] at org.codehaus.groovy.classgen.AsmClassGenerator.getStaticFieldName(AsmClassGenerator.java:1706)
      [java] at org.codehaus.groovy.classgen.AsmClassGenerator.visitClassExpression(AsmClassGenerator.java:2322)
      [java] at org.codehaus.groovy.classgen.AsmClassGenerator.doConvertAndCast(AsmClassGenerator.java:2724)
      [java] at org.codehaus.groovy.classgen.AsmClassGenerator.doConvertAndCast(AsmClassGenerator.java:1014)
      [java] at org.codehaus.groovy.classgen.AsmClassGenerator.visitCastExpression(AsmClassGenerator.java:1427)
      [java] at org.codehaus.groovy.ast.expr.CastExpression.visit(CastExpression.java:96)
      [java] at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:2961)

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            jshickey Scott Hickey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: